From 49074cfdbf497ee27489a8699d65734d7fd65d3d Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Fri, 17 Jun 2022 01:11:05 +0530 Subject: [PATCH] update test_cmd_line to ignore CosmoImporter test_cmd_line did not consider that sys.meta_path would have a different starting entry, and so what would happen in the isolated mode test is that CosmoImporter would pick up uuid.pyc from the zip store, and claim no errors in both cases. Now the test removes CosmoImporter from sys.meta_path and so the expected behavior occurs again. --- third_party/python/Lib/test/test_cmd_line.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/third_party/python/Lib/test/test_cmd_line.py b/third_party/python/Lib/test/test_cmd_line.py index 71901fab1..83c0e5d87 100644 --- a/third_party/python/Lib/test/test_cmd_line.py +++ b/third_party/python/Lib/test/test_cmd_line.py @@ -483,6 +483,10 @@ class CmdLineTest(unittest.TestCase): with open(fake, "w") as f: f.write("raise RuntimeError('isolated mode test')\n") with open(main, "w") as f: + f.write("import sys\n") + f.write("import _imp\n") + f.write("if sys.meta_path[0] == _imp.CosmoImporter:\n") + f.write("\tsys.meta_path.pop(0)\n") f.write("import uuid\n") f.write("print('ok')\n") self.assertRaises(subprocess.CalledProcessError,