summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-05-11 14:08:50 -0400
committerJason R. Coombs <jaraco@jaraco.com>2018-05-11 14:08:50 -0400
commit208801dde6194de58481db4c8a4026f2ec0ca2cd (patch)
tree4d7b98a5b7f2271d753dc8c88f3b810b03b803cd
parentfb330f4219e6d8615c93ea4f2cb82c0ec151b1ce (diff)
downloadcherrypy-git-208801dde6194de58481db4c8a4026f2ec0ca2cd.tar.gz
The introduction of ./conftest.py seems to have caused 'tests' to be prepended to the path. As a result, remove_sys_path_0 no longer worked as expected. Re-write that fixture to accomplish the intended goal.
-rw-r--r--tests/dist-check.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/dist-check.py b/tests/dist-check.py
index e4d614f0..8930952b 100644
--- a/tests/dist-check.py
+++ b/tests/dist-check.py
@@ -12,6 +12,8 @@ suite because it must import cherrypy late (after
removing sys.path[0]).
"""
+from __future__ import print_function
+
import os
import sys
@@ -30,10 +32,16 @@ def data_file_path(request):
@pytest.fixture(autouse=True, scope='session')
-def remove_sys_path_0():
- 'pytest adds cwd to sys.path[0]'
- print('removing', sys.path[0])
- del sys.path[0]
+def remove_paths_to_checkout():
+ """Remove paths to ./cherrypy"""
+ to_remove = [
+ path
+ for path in sys.path
+ if os.path.isdir(path)
+ and os.path.samefile(path, os.path.curdir)
+ ]
+ print("Removing", to_remove)
+ list(map(sys.path.remove, to_remove))
assert 'cherrypy' not in sys.modules