regress/regress.py can be run from inside regress/

This commit is contained in:
Nguyen Anh Quynh 2015-09-19 17:06:50 +07:00
parent cbb2cf3618
commit 4d45f11a08

7
regress/regress.py Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/python
import unittest import unittest
from os.path import dirname, basename, isfile from os.path import dirname, basename, isfile
@ -12,7 +14,10 @@ def main():
unittest.main() unittest.main()
if __name__ == '__main__': if __name__ == '__main__':
modules = glob.glob(dirname(__file__)+"./*.py") directory = dirname(__file__)
if directory == '':
directory = '.'
modules = glob.glob(directory+"/*.py")
__all__ = [ basename(f)[:-3] for f in modules if isfile(f)] __all__ = [ basename(f)[:-3] for f in modules if isfile(f)]
suite = unittest.TestSuite() suite = unittest.TestSuite()