summaryrefslogtreecommitdiff
path: root/tests/test_runner
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_runner')
-rw-r--r--tests/test_runner/test_discover_runner.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py
index d577f26826..fd68949678 100644
--- a/tests/test_runner/test_discover_runner.py
+++ b/tests/test_runner/test_discover_runner.py
@@ -68,6 +68,34 @@ class DiscoverRunnerTest(TestCase):
self.assertEqual(count, 3)
+ def test_empty_test_case(self):
+ count = DiscoverRunner().build_suite(
+ ["test_discovery_sample.tests_sample.EmptyTestCase"],
+ ).countTestCases()
+
+ self.assertEqual(count, 0)
+
+ def test_discovery_on_package(self):
+ count = DiscoverRunner().build_suite(
+ ["test_discovery_sample.tests"],
+ ).countTestCases()
+
+ self.assertEqual(count, 1)
+
+ def test_ignore_adjacent(self):
+ """
+ When given a dotted path to a module, unittest discovery searches
+ not just the module, but also the directory containing the module.
+
+ This results in tests from adjacent modules being run when they
+ should not. The discover runner avoids this behavior.
+ """
+ count = DiscoverRunner().build_suite(
+ ["test_discovery_sample.empty"],
+ ).countTestCases()
+
+ self.assertEqual(count, 0)
+
def test_overrideable_test_suite(self):
self.assertEqual(DiscoverRunner().test_suite, TestSuite)