test.py
#!/usr/bin/env python
import unittest
import sys
for module in sys.argv[1:]:
done = False
while not done and module != "":
try:
exec('import ' + module)
done = True
except Exception:
module = module.rpartition('.')[0]
unittest.main()
This will allow you to run any unit tests in any module from the command line.
test.py mypackage.test yourpackage.test
test.py mypackage.test.TestXYZ.testRun
No comments:
Post a Comment