diff options
Diffstat (limited to 'testsuite/Testsrc/test_code_checks.py')
-rw-r--r-- | testsuite/Testsrc/test_code_checks.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/testsuite/Testsrc/test_code_checks.py b/testsuite/Testsrc/test_code_checks.py index 7d168af75..85aea29d6 100644 --- a/testsuite/Testsrc/test_code_checks.py +++ b/testsuite/Testsrc/test_code_checks.py @@ -170,10 +170,14 @@ class CodeTestCase(Bcfg2TestCase): return self.has_command def get_env(self): - env = copy.copy(os.environ) - env['PYTHONPATH'] = ':'.join([env.get("PYTHONPATH", ""), - testdir]) - return env + if ('PYTHONPATH' not in os.environ or + testdir not in os.environ['PYTHONPATH'].split(":")): + env = copy.copy(os.environ) + env['PYTHONPATH'] = ':'.join([env.get("PYTHONPATH", ""), + testdir]) + return env + else: + return os.environ def _test_full(self, files, extra_args=None): """ test select files for all problems """ |