diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-03-04 04:16:16 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-03-04 18:02:07 +0100 |
commit | a50def839c9ead7f05ea90c093a64794f79ed243 (patch) | |
tree | e88b304fa53ffffa7299981671e10b120f772c4c /selftest/tests | |
parent | 616139c01e03799f2cb047f78c60d3afc004d15e (diff) | |
download | samba-a50def839c9ead7f05ea90c093a64794f79ed243.tar.gz samba-a50def839c9ead7f05ea90c093a64794f79ed243.tar.bz2 samba-a50def839c9ead7f05ea90c093a64794f79ed243.zip |
selftest.testlist: Add manager for restricted test lists.
Diffstat (limited to 'selftest/tests')
-rw-r--r-- | selftest/tests/test_testlist.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/selftest/tests/test_testlist.py b/selftest/tests/test_testlist.py index 0e7f68bf8e..4405e86003 100644 --- a/selftest/tests/test_testlist.py +++ b/selftest/tests/test_testlist.py @@ -20,6 +20,7 @@ """Tests for selftest.testlist.""" from selftest.testlist import ( + RestrictedTestManager, find_in_list, read_test_regexes, read_testlist, @@ -71,3 +72,31 @@ class ReadTestlistTests(unittest.TestCase): self.assertEquals([('foo', 'bar', 'bla', False, False)], list(read_testlist(inf, outf))) self.assertEquals("MORENOISE\nNOISE\n", outf.getvalue()) + + + +class RestrictedTestManagerTests(unittest.TestCase): + + def test_unused(self): + mgr = RestrictedTestManager(["foo.bar"]) + self.assertEquals(["foo.bar"], list(mgr.iter_unused())) + + def test_run_testsuite(self): + mgr = RestrictedTestManager(["foo.bar"]) + self.assertEquals(None, mgr.should_run_testsuite("foo.bar")) + + def test_run_subtest(self): + mgr = RestrictedTestManager(["foo.bar.bla"]) + self.assertEquals(["bla"], mgr.should_run_testsuite("foo.bar")) + + def test_run_subtest_after_testsuite(self): + mgr = RestrictedTestManager(["foo.bar", "foo.bar.bla"]) + self.assertEquals(None, mgr.should_run_testsuite("foo.bar")) + + def test_run_multiple_subtests(self): + mgr = RestrictedTestManager(["foo.bar.blie", "foo.bar.bla"]) + self.assertEquals(["blie", "bla"], mgr.should_run_testsuite("foo.bar")) + + def test_run_nomatch(self): + mgr = RestrictedTestManager(["foo.bar"]) + self.assertEquals([], mgr.should_run_testsuite("foo.blie.bla")) |