diff --git a/test/testall.py b/test/testall.py index 88eb70117..418b4a3ca 100755 --- a/test/testall.py +++ b/test/testall.py @@ -22,16 +22,15 @@ import re import sys import unittest -pkgpath = os.path.dirname(__file__) or '.' -sys.path.append(pkgpath) -os.chdir(pkgpath) +pkgpath = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) or '..' +sys.path.insert(0, pkgpath) def suite(): s = unittest.TestSuite() # Get the suite() of every module in this directory beginning with # "test_". - for fname in os.listdir(pkgpath): + for fname in os.listdir(os.path.join(pkgpath, 'test')): match = re.match(r'(test_\S+)\.py$', fname) if match: modname = match.group(1)