/
runner.py
35 lines (26 loc) · 1014 Bytes
/
runner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# Copyright (C) 2007 Giampaolo Rodola' <g.rodola@gmail.com>.
# Use of this source code is governed by MIT license that can be
# found in the LICENSE file.
import os
import sys
from pyftpdlib.test import configure_logging
from pyftpdlib.test import remove_test_files
from pyftpdlib.test import unittest
from pyftpdlib.test import VERBOSITY
HERE = os.path.abspath(os.path.dirname(__file__))
def main():
testmodules = [os.path.splitext(x)[0] for x in os.listdir(HERE)
if x.endswith('.py') and x.startswith('test_')]
configure_logging()
remove_test_files()
suite = unittest.TestSuite()
for t in testmodules:
# ...so that "make test" will print the full test paths
t = "pyftpdlib.test.%s" % t
suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t))
result = unittest.TextTestRunner(verbosity=VERBOSITY).run(suite)
return result.wasSuccessful()
if __name__ == '__main__':
if not main():
sys.exit(1)