How to use build_suite method in tappy

Best Python code snippet using tappy_python

test_discover_runner.py

Source:test_discover_runner.py Github

copy

Full Screen

...14 finally:15 os.chdir(old_cwd)16class DiscoverRunnerTest(TestCase):17 def test_dotted_test_module(self):18 count = DiscoverRunner().build_suite(19 ["test_discovery_sample.tests_sample"],20 ).countTestCases()21 self.assertEqual(count, 4)22 def test_dotted_test_class_vanilla_unittest(self):23 count = DiscoverRunner().build_suite(24 ["test_discovery_sample.tests_sample.TestVanillaUnittest"],25 ).countTestCases()26 self.assertEqual(count, 1)27 def test_dotted_test_class_django_testcase(self):28 count = DiscoverRunner().build_suite(29 ["test_discovery_sample.tests_sample.TestDjangoTestCase"],30 ).countTestCases()31 self.assertEqual(count, 1)32 def test_dotted_test_method_django_testcase(self):33 count = DiscoverRunner().build_suite(34 ["test_discovery_sample.tests_sample.TestDjangoTestCase.test_sample"],35 ).countTestCases()36 self.assertEqual(count, 1)37 def test_pattern(self):38 count = DiscoverRunner(39 pattern="*_tests.py",40 ).build_suite(["test_discovery_sample"]).countTestCases()41 self.assertEqual(count, 1)42 def test_file_path(self):43 with change_cwd(".."):44 count = DiscoverRunner().build_suite(45 ["test_discovery_sample/"],46 ).countTestCases()47 self.assertEqual(count, 5)48 def test_empty_label(self):49 """50 If the test label is empty, discovery should happen on the current51 working directory.52 """53 with change_cwd("."):54 suite = DiscoverRunner().build_suite([])55 self.assertEqual(56 suite._tests[0].id().split(".")[0],57 os.path.basename(os.getcwd()),58 )59 def test_empty_test_case(self):60 count = DiscoverRunner().build_suite(61 ["test_discovery_sample.tests_sample.EmptyTestCase"],62 ).countTestCases()63 self.assertEqual(count, 0)64 def test_discovery_on_package(self):65 count = DiscoverRunner().build_suite(66 ["test_discovery_sample.tests"],67 ).countTestCases()68 self.assertEqual(count, 1)69 def test_ignore_adjacent(self):70 """71 When given a dotted path to a module, unittest discovery searches72 not just the module, but also the directory containing the module.73 This results in tests from adjacent modules being run when they74 should not. The discover runner avoids this behavior.75 """76 count = DiscoverRunner().build_suite(77 ["test_discovery_sample.empty"],78 ).countTestCases()79 self.assertEqual(count, 0)80 def test_testcase_ordering(self):81 suite = DiscoverRunner().build_suite(["test_discovery_sample/"])82 self.assertEqual(83 suite._tests[0].__class__.__name__,84 'TestDjangoTestCase',85 msg="TestDjangoTestCase should be the first test case")86 self.assertEqual(87 suite._tests[1].__class__.__name__,88 'TestZimpleTestCase',89 msg="TestZimpleTestCase should be the second test case")90 # All others can follow in unspecified order, including doctests91 self.assertIn('DocTestCase', [t.__class__.__name__ for t in suite._tests[2:]])92 def test_overrideable_test_suite(self):93 self.assertEqual(DiscoverRunner().test_suite, TestSuite)94 def test_overrideable_test_runner(self):95 self.assertEqual(DiscoverRunner().test_runner, TextTestRunner)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tappy automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful