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.
This commit is contained in:
ahgamut 2022-06-17 01:11:05 +05:30
parent 4aeaa5a181
commit 49074cfdbf

View file

@ -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,