Exemplo n.º 1
0
class NoseSelectPluginTesterPositiveTest(PluginTester, unittest.TestCase):
    activate = ''
    plugins = [NoseSelectPlugin()]
    suitepath = base_dir
    args = ['-v', '--exe', '--select-tests=is_selected']

    def test_selection_is_correct(self):
        assert all(x in self.output
                   for x in ['tests.test_module.TestClassWithSetupAndSelectedMethod_but_Class_that_is_not_selected',
                             'tests.test_module.test_bare_function_that_is_selected',
                             'tests.test_module_with_not_selected_class.test_bare_function_that_is_selected',])
Exemplo n.º 2
0
class NoseSelectPluginTesterIvertedTest(PluginTester, unittest.TestCase):
    activate = ''
    plugins = [NoseSelectPlugin()]
    suitepath = base_dir
    args = ['-v', '--exe', '--select-tests=is_not_selected']

    def test_selection_is_correctly_inverted(self):
        assert all(x in self.output
                   for x in ['FAIL: tests.test_module_with_not_selected_class.test_bare_function_that_is_not_selected',
                             "ERROR: test suite for <class 'tests.test_module_with_not_selected_class.TestClassWithSetupNotSelected_that_is_not_selected'>",
                             'test_method_that_is_not_selected (tests.test_module.TestClassWithSetupAndSelectedMethod_but_Class_that_is_not_selected) ... ok',
                             'test_method_that_is_selected (tests.test_module.TestClassWithSetupAndSelectedMethod_but_Class_that_is_not_selected) ... ok',
        ])
Exemplo n.º 3
0
 def test_is_selected_selects_module(self):
     plugin = NoseSelectPlugin()
     plugin.add_criterion('noseselecttests.tests')
     self.assertTrue(plugin._is_selected(DummyTest))
Exemplo n.º 4
0
 def test_is_selected_false(self):
     plugin = NoseSelectPlugin()
     plugin.add_criterion('foobar')
     self.assertFalse(plugin._is_selected(fobj))
Exemplo n.º 5
0
 def test_is_selected_wildcard(self):
     plugin = NoseSelectPlugin()
     plugin.add_criterion('configure*complex')
     self.assertTrue(plugin._is_selected(configure_complex))
Exemplo n.º 6
0
 def test_is_selected_case_insensitive(self):
     plugin = NoseSelectPlugin()
     plugin.add_criterion('fObJ')
     self.assertTrue(plugin._is_selected(fobj))
Exemplo n.º 7
0
    def test_is_selected_function(self):
        plugin = NoseSelectPlugin()

        plugin.add_criterion('fobj')
        self.assertTrue(plugin._is_selected(fobj))
Exemplo n.º 8
0
    def test_configure_or(self):
        plugin = NoseSelectPlugin()
        plugin.configure(self._get_options(['foobar', 'FOO']), self._get_config())

        self.assertEqual(plugin.selection_criteria, ['*foobar*', '*foo*'])
        self.assertTrue(plugin.enabled)
Exemplo n.º 9
0
    def test_configure_empty_string(self):
        plugin = NoseSelectPlugin()
        plugin.configure(self._get_options(['']), self._get_config())

        self.assertEqual(plugin.selection_criteria, [])
        self.assertFalse(plugin.enabled)
Exemplo n.º 10
0
 def test_is_selected_selects_method_bound(self):
     plugin = NoseSelectPlugin()
     plugin.add_criterion('DummyTest.test_foo')
     self.assertTrue(plugin._is_selected(DummyTest().test_foo))
Exemplo n.º 11
0
 def test_is_selected_selects_class(self):
     plugin = NoseSelectPlugin()
     plugin.add_criterion('DummyTest')
     self.assertTrue(plugin._is_selected(DummyTest))