Merge pull request #3277 from beetbox/arcresu-patch-3

Setup path correctly in testall.py
This commit is contained in:
Adrian Sampson 2019-05-30 21:51:14 -04:00 committed by GitHub
commit 4fc9e2686b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)