1 | n/a | import os |
---|
2 | n/a | import unittest |
---|
3 | n/a | |
---|
4 | n/a | |
---|
5 | n/a | def load_tests(loader, standard_tests, pattern): |
---|
6 | n/a | # top level directory cached on loader instance |
---|
7 | n/a | this_dir = os.path.dirname(__file__) |
---|
8 | n/a | pattern = pattern or "test_*.py" |
---|
9 | n/a | # We are inside unittest.test, so the top-level is two notches up |
---|
10 | n/a | top_level_dir = os.path.dirname(os.path.dirname(this_dir)) |
---|
11 | n/a | package_tests = loader.discover(start_dir=this_dir, pattern=pattern, |
---|
12 | n/a | top_level_dir=top_level_dir) |
---|
13 | n/a | standard_tests.addTests(package_tests) |
---|
14 | n/a | return standard_tests |
---|
15 | n/a | |
---|
16 | n/a | |
---|
17 | n/a | if __name__ == '__main__': |
---|
18 | n/a | unittest.main() |
---|