3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

runtests: allow specifying files to test

This commit is contained in:
James Lu 2015-09-12 22:27:52 -07:00
parent 46fab1cab7
commit 4b7ef44925

View File

@ -11,7 +11,10 @@ suites = []
# Yay, import hacks! # Yay, import hacks!
sys.path.append(os.path.join(os.getcwd(), 'tests')) sys.path.append(os.path.join(os.getcwd(), 'tests'))
for testfile in glob.glob('tests/test_*.py'):
query = sys.argv[1:] or glob.glob('tests/test_*.py')
for testfile in query:
# Strip the tests/ and .py extension: tests/test_whatever.py => test_whatever # Strip the tests/ and .py extension: tests/test_whatever.py => test_whatever
module = testfile.replace('.py', '').replace('tests/', '') module = testfile.replace('.py', '').replace('tests/', '')
module = __import__(module) module = __import__(module)