summaryrefslogtreecommitdiff
path: root/pytest.py
diff options
context:
space:
mode:
authorStephanie Marcu <stephanie.marcu@logilab.fr>2008-05-23 14:14:59 +0200
committerStephanie Marcu <stephanie.marcu@logilab.fr>2008-05-23 14:14:59 +0200
commit41af233d81a1cd1d86b75f23a2c0cb48235bbfc7 (patch)
treea25469088ba1117096539b70afd1e8e6e38a8b24 /pytest.py
parentc2b9b7c5652a88072fbaf509d846a80fd92d3a7b (diff)
downloadlogilab-common-41af233d81a1cd1d86b75f23a2c0cb48235bbfc7.tar.gz
consider the current directory as a test dir even if its name is not test or tests
Diffstat (limited to 'pytest.py')
-rw-r--r--pytest.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/pytest.py b/pytest.py
index d7382b9..ec2d8b7 100644
--- a/pytest.py
+++ b/pytest.py
@@ -300,7 +300,8 @@ class PyTester(object):
"""walks trhough current working directory, finds something
which can be considered as a testdir and runs every test there
"""
- for dirname, dirs, files in os.walk(os.getcwd()):
+ here = os.getcwd()
+ for dirname, dirs, _ in os.walk(here):
for skipped in ('CVS', '.svn', '.hg'):
if skipped in dirs:
dirs.remove(skipped)
@@ -310,7 +311,11 @@ class PyTester(object):
# we found a testdir, let's explore it !
self.testonedir(dirname, exitfirst)
dirs[:] = []
-
+ if self.report.ran == 0:
+ # if no test was found during the visit, consider
+ # the local directory as a test directory even if
+ # it doesn't have a traditional test directory name
+ self.testonedir(here)
def testonedir(self, testdir, exitfirst=False):
"""finds each testfile in the `testdir` and runs it"""