Commit 314b8a17 authored by Stefan H. Holek's avatar Stefan H. Holek

Made runalltests skip 'tests.py' when running ZTC tests.

parent 0f8c43cb
...@@ -27,12 +27,16 @@ if __name__ == '__main__': ...@@ -27,12 +27,16 @@ if __name__ == '__main__':
import unittest import unittest
TestRunner = unittest.TextTestRunner TestRunner = unittest.TextTestRunner
suite = unittest.TestSuite() suite = unittest.TestSuite()
cwd = os.getcwd()
def test_finder(recurse, dir, names): def test_finder(recurse, dir, names):
if dir == os.curdir or '__init__.py' in names: if dir == os.curdir or '__init__.py' in names:
parts = [x for x in dir[len(os.curdir):].split(os.sep) if x] parts = [x for x in dir[len(os.curdir):].split(os.sep) if x]
tests = [x for x in names if x.startswith('test') and x.endswith('.py')] tests = [x for x in names if x.startswith('test') and x.endswith('.py')]
for test in tests: for test in tests:
if test == 'tests.py' and 'ZopeTestCase' in cwd:
# Skip tests.py when running ZTC tests
continue
modpath = parts + [test[:-3]] modpath = parts + [test[:-3]]
m = __import__('.'.join(modpath)) m = __import__('.'.join(modpath))
for part in modpath[1:]: for part in modpath[1:]:
......
...@@ -27,12 +27,16 @@ if __name__ == '__main__': ...@@ -27,12 +27,16 @@ if __name__ == '__main__':
import unittest import unittest
TestRunner = unittest.TextTestRunner TestRunner = unittest.TextTestRunner
suite = unittest.TestSuite() suite = unittest.TestSuite()
cwd = os.getcwd()
def test_finder(recurse, dir, names): def test_finder(recurse, dir, names):
if dir == os.curdir or '__init__.py' in names: if dir == os.curdir or '__init__.py' in names:
parts = [x for x in dir[len(os.curdir):].split(os.sep) if x] parts = [x for x in dir[len(os.curdir):].split(os.sep) if x]
tests = [x for x in names if x.startswith('test') and x.endswith('.py')] tests = [x for x in names if x.startswith('test') and x.endswith('.py')]
for test in tests: for test in tests:
if test == 'tests.py' and 'ZopeTestCase' in cwd:
# Skip tests.py when running ZTC tests
continue
modpath = parts + [test[:-3]] modpath = parts + [test[:-3]]
m = __import__('.'.join(modpath)) m = __import__('.'.join(modpath))
for part in modpath[1:]: for part in modpath[1:]:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment