summaryrefslogtreecommitdiff
path: root/pytest.py
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2008-01-18 09:08:52 +0100
committerSylvain <syt@logilab.fr>2008-01-18 09:08:52 +0100
commita62ff72dfae07ad1cf54bd7dda0bd1af570ca7e0 (patch)
tree4b4e8234908c1d58653e27b6bf2be140bc0c6941 /pytest.py
parentbee36ebf12b00fda1ae68f3530d5987a6cc696c6 (diff)
downloadlogilab-common-a62ff72dfae07ad1cf54bd7dda0bd1af570ca7e0.tar.gz
remove sys.path modification in pytest
Diffstat (limited to 'pytest.py')
-rw-r--r--pytest.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/pytest.py b/pytest.py
index f800e9e..f0d3ebf 100644
--- a/pytest.py
+++ b/pytest.py
@@ -109,7 +109,7 @@ def this_is_a_testdir(dirpath):
return osp.basename(dirpath) in ('test', 'tests', 'unittests')
-def autopath(projdir=os.getcwd()):
+def project_root(projdir=os.getcwd()):
"""try to find project's root and add it to sys.path"""
curdir = osp.abspath(projdir)
previousdir = curdir
@@ -120,9 +120,6 @@ def autopath(projdir=os.getcwd()):
break
previousdir = curdir
curdir = newdir
- else:
- sys.path.insert(0, curdir)
- sys.path.insert(0, '')
return previousdir
@@ -509,13 +506,13 @@ def parseargs():
def run():
- rootdir = autopath()
options, newargs, explicitfile = parseargs()
# mock a new command line
sys.argv[1:] = newargs
covermode = getattr(options, 'coverage', None)
cvg = None
if covermode:
+ rootdir = project_root()
# control_import_coverage(rootdir)
from logilab.devtools.lib.coverage import Coverage
cvg = Coverage([rootdir])