Skip to content

Commit

Permalink
tests: fix ordering of PYTHONPATH (#1210)
Browse files Browse the repository at this point in the history
* tests: fix ordering of PYTHONPATH
If you run the sitecustomize test cases on their own they fail because
they import the ddtrace/bootstrap/sitecustomize.py module and not
the tests/commands/bootstrap/sitecustomize.py module.

This is because this helper code would put the test bootstrap module
on the end of the PYTHONPATH, which means it gets looked at last.

I have no idea how this seems to work ok when you run the entire
test suite together, must be an odd dependency on a previous test
case?

* fix flake8
  • Loading branch information
brettlangdon authored Feb 14, 2020
1 parent 4653e97 commit 9d896c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/commands/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def inject_sitecustomize(path):
env = os.environ.copy()
sitecustomize = os.path.join(root_folder, '..', path)

# Add `boostrap` module so that `sitecustomize.py` is at the bottom
# of the PYTHONPATH
python_path = list(sys.path) + [sitecustomize]
env['PYTHONPATH'] = ':'.join(python_path)[1:]
# Add `bootstrap` directory to the beginning of PYTHONTPATH so we know
# if `import sitecustomize` is run that it'll be the one we specify
python_path = [sitecustomize] + list(sys.path)
env['PYTHONPATH'] = ':'.join(python_path)
return env


Expand Down

0 comments on commit 9d896c3

Please sign in to comment.