summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-09-13 22:39:15 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-09-13 22:39:15 (GMT)
commit4b3c58c8a0b0c041854e80e9a01aeb5d77872a05 (patch)
tree94aa3362468be3cf6a9ecf5c59a8e08bfb6a5e8f /Lib
parente1ba8df182923c103fd595a1a0c5a8be9b381dbb (diff)
downloadcpython-4b3c58c8a0b0c041854e80e9a01aeb5d77872a05.zip
cpython-4b3c58c8a0b0c041854e80e9a01aeb5d77872a05.tar.gz
cpython-4b3c58c8a0b0c041854e80e9a01aeb5d77872a05.tar.bz2
Issue #19013: add a __main__ to unittest.test.testmock to ease CLI invocation
Diffstat (limited to 'Lib')
-rw-r--r--Lib/unittest/test/testmock/__main__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/__main__.py b/Lib/unittest/test/testmock/__main__.py
new file mode 100644
index 0000000..24e1933
--- /dev/null
+++ b/Lib/unittest/test/testmock/__main__.py
@@ -0,0 +1,18 @@
+import os
+import unittest
+
+
+def load_tests(loader, standard_tests, pattern):
+ # top level directory cached on loader instance
+ this_dir = os.path.dirname(__file__)
+ pattern = pattern or "test*.py"
+ # We are inside unittest.test, so the top-level is two notches up
+ top_level_dir = os.path.dirname(os.path.dirname(os.path.dirname(this_dir)))
+ package_tests = loader.discover(start_dir=this_dir, pattern=pattern,
+ top_level_dir=top_level_dir)
+ standard_tests.addTests(package_tests)
+ return standard_tests
+
+
+if __name__ == '__main__':
+ unittest.main()