From Dan Kenigsberg <dan...@redhat.com>: Dan Kenigsberg has posted comments on this change.
Change subject: tests: Avoid global state modification using forked ...................................................................... Patch Set 1: (2 comments) https://gerrit.ovirt.org/#/c/67338/1/tests/moduleloader_test.py File tests/moduleloader_test.py: Line 39: for f in files: Line 40: utils.touchFile(os.path.join(path, f)) Line 41: utils.touchFile(os.path.join(path, '__init__.py')) Line 42: sys.path.append(os.path.dirname(path)) Line 43: yield importlib.import_module(os.path.basename(path)) > If we run each test in a new child process, we don't need to clean anything this is true for all tests. Still, we care to use MonkeyPatch to clean after ourselves! Line 44: Line 45: @permutations( Line 46: [(('a.py', 'b.py'), ('a', 'b')), Line 47: (('a.py', 'b.py', 'a.pyc', 'a.pyioas'), ('a', 'b')), Line 47: (('a.py', 'b.py', 'a.pyc', 'a.pyioas'), ('a', 'b')), Line 48: (('a.py', 'b.py', 'a.pyc', 'a.py'), ('a', 'b')), Line 49: (('a.py', 'b.py', 'a.pyc', '_my.py'), ('a', 'b', '_my'))] Line 50: ) Line 51: @forked > Importing stuff into python leave traces in sys.modules that are not easy ( I'm anxious to see Travis green, and thank you for all these cleanups. I simply don't understand how the traceback that we see is related to a stale sys.path, so this patch seems a bit of black magic to me... Yes, I'd love to mark that test as broken (but the patch doing it is high on a chain of other fixes) Line 52: def test_import_modules(self, files, expected_modules): Line 53: with self._setup_test_modules(files) as module_name: Line 54: result = moduleloader.load_modules(module_name) Line 55: -- To view, visit https://gerrit.ovirt.org/67338 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2130bcf39918c3c70ed9f8eb9c436c5c8f9c6c09 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Francesco Romani <from...@redhat.com> Gerrit-Reviewer: Irit Goihman <igoih...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczew...@gmail.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org