Exemplo n.º 1
0
 def settings(self):
     return [
         self.documentation,
         FixtureController(self, self._test.setup),
         FixtureController(self, self._test.teardown),
         TimeoutController(self, self._test.timeout),
         TemplateController(self, self._test.template), self.tags
     ]
Exemplo n.º 2
0
 def _settings(self):
     ss = self.data.setting_table
     return [
         DocumentationController(self, ss.doc),
         FixtureController(self, ss.suite_setup),
         FixtureController(self, ss.suite_teardown),
         FixtureController(self, ss.test_setup),
         FixtureController(self, ss.test_teardown), self.force_tags
     ]
Exemplo n.º 3
0
 def teardown(self):
     if self._teardown == self._TEARDOWN_NOT_SET:
         self._teardown = None
         if hasattr(self._kw, 'teardown'):
             self._teardown = FixtureController(self, self._kw.teardown)
     return self._teardown
Exemplo n.º 4
0
 def setUp(self):
     self.fix = Fixture('Suite Setup')
     self.fix.name = 'My Setup'
     self.fix.args = ['argh', 'urgh']
     self.parent = _FakeParent()
     self.ctrl = FixtureController(self.parent, self.fix)
Exemplo n.º 5
0
class FixtureControllerTest(unittest.TestCase):

    def setUp(self):
        self.fix = Fixture('Suite Setup')
        self.fix.name = 'My Setup'
        self.fix.args = ['argh', 'urgh']
        self.parent = _FakeParent()
        self.ctrl = FixtureController(self.parent, self.fix)

    def test_creation(self):
        assert_equals(self.ctrl.display_value, 'My Setup | argh | urgh')
        assert_equals(self.ctrl.label, 'Suite Setup')
        assert_true(self.ctrl.is_set)

    def test_value_with_empty_fixture(self):
        assert_equals(FixtureController(self.parent, Fixture('Teardown')).display_value, '')

    def test_setting_value_changes_fixture_state(self):
        self.ctrl.set_value('Blaa')
        assert_equals(self.fix.name, 'Blaa')
        assert_equals(self.fix.args, [])
        self.ctrl.set_value('Blaa | a')
        assert_equals(self.fix.name, 'Blaa')
        assert_equals(self.fix.args, ['a'])

    def test_whitespace_is_ignored_in_value(self):
        self.ctrl.set_value('Name |   a    |    b      |     c')
        assert_equals(self.fix.name, 'Name')
        assert_equals(self.fix.args, ['a', 'b', 'c'])
        assert_equals(self.ctrl.display_value, 'Name | a | b | c')

    def test_setting_value_informs_parent_controller_about_dirty_model(self):
        self.ctrl.set_value('Blaa')
        assert_true(self.ctrl.dirty)

    def test_set_empty_value(self):
        self.ctrl.set_value('')
        assert_equals(self.fix.name, '')
        assert_equals(self.fix.args, [])
        assert_true(self.ctrl.dirty)

    def test_same_value(self):
        self.ctrl.set_value('My Setup | argh | urgh')
        assert_false(self.ctrl.dirty)

    def test_setting_comment(self):
        self.ctrl.set_comment(['My comment'])
        assert_equals(self.ctrl.comment.as_list(), ['# My comment'])
        assert_true(self.ctrl.dirty)
Exemplo n.º 6
0
 def test_contains_keyword_with_regexp_with_empty_fixture(self):
     empty_fixture_controller = FixtureController(self.parent, Fixture('Setup'))
     keyword_regexp = re.compile(r'foo.*bar')
     assert_false(empty_fixture_controller.contains_keyword(keyword_regexp))
Exemplo n.º 7
0
 def setUp(self):
     self.fix = Fixture('Suite Setup')
     self.fix.name = 'My Setup'
     self.fix.args = ['argh', 'urgh']
     self.parent = _FakeParent()
     self.ctrl = FixtureController(self.parent, self.fix)
Exemplo n.º 8
0
class FixtureControllerTest(unittest.TestCase):

    def setUp(self):
        self.fix = Fixture('Suite Setup')
        self.fix.name = 'My Setup'
        self.fix.args = ['argh', 'urgh']
        self.parent = _FakeParent()
        self.ctrl = FixtureController(self.parent, self.fix)

    def test_creation(self):
        assert_equals(self.ctrl.display_value, 'My Setup | argh | urgh')
        assert_equals(self.ctrl.label, 'Suite Setup')
        assert_true(self.ctrl.is_set)

    def test_value_with_empty_fixture(self):
        assert_equals(FixtureController(self.parent, Fixture('Teardown')).display_value, '')

    def test_setting_value_changes_fixture_state(self):
        self.ctrl.set_value('Blaa')
        assert_equals(self.fix.name, 'Blaa')
        assert_equals(self.fix.args, [])
        self.ctrl.set_value('Blaa | a')
        assert_equals(self.fix.name, 'Blaa')
        assert_equals(self.fix.args, ['a'])

    def test_whitespace_is_ignored_in_value(self):
        self.ctrl.set_value('Name |   a    |    b      |     c')
        assert_equals(self.fix.name, 'Name')
        assert_equals(self.fix.args, ['a', 'b', 'c'])
        assert_equals(self.ctrl.display_value, 'Name | a | b | c')

    def test_setting_value_informs_parent_controller_about_dirty_model(self):
        self.ctrl.set_value('Blaa')
        assert_true(self.ctrl.dirty)

    def test_set_empty_value(self):
        self.ctrl.set_value('')
        assert_equals(self.fix.name, '')
        assert_equals(self.fix.args, [])
        assert_true(self.ctrl.dirty)

    def test_same_value(self):
        self.ctrl.set_value('My Setup | argh | urgh')
        assert_false(self.ctrl.dirty)

    def test_setting_comment(self):
        self.ctrl.set_comment(['My comment'])
        assert_equals(self.ctrl.comment.as_list(), ['# My comment'])
        assert_true(self.ctrl.dirty)

    def test_contains_keyword_with_regexp_with_empty_fixture(self):
        empty_fixture_controller = FixtureController(self.parent, Fixture('Setup'))
        keyword_regexp = re.compile(r'foo.*bar')
        assert_false(empty_fixture_controller.contains_keyword(keyword_regexp))
Exemplo n.º 9
0
 def test_contains_keyword_with_regexp_with_empty_fixture(self):
     empty_fixture_controller = FixtureController(self.parent, Fixture('Setup'))
     keyword_regexp = re.compile(r'foo.*bar')
     assert_false(empty_fixture_controller.contains_keyword(keyword_regexp))
Exemplo n.º 10
0
 def test_value_with_empty_fixture(self):
     assert_equals(FixtureController(self.parent, Fixture('Teardown')).display_value, '')
 def teardown(self):
     if self._teardown == self._TEARDOWN_NOT_SET:
         self._teardown = FixtureController(self, self._kw.teardown)
     return self._teardown
Exemplo n.º 12
0
 def setUp(self):
     self.fix = Fixture("Suite Setup")
     self.fix.name = "My Setup"
     self.fix.args = ["argh", "urgh"]
     self.parent = _FakeParent()
     self.ctrl = FixtureController(self.parent, self.fix)
Exemplo n.º 13
0
class FixtureControllerTest(unittest.TestCase):
    def setUp(self):
        self.fix = Fixture("Suite Setup")
        self.fix.name = "My Setup"
        self.fix.args = ["argh", "urgh"]
        self.parent = _FakeParent()
        self.ctrl = FixtureController(self.parent, self.fix)

    def test_creation(self):
        assert_equals(self.ctrl.display_value, "My Setup | argh | urgh")
        assert_equals(self.ctrl.label, "Suite Setup")
        assert_true(self.ctrl.is_set)

    def test_value_with_empty_fixture(self):
        assert_equals(FixtureController(self.parent, Fixture("Teardown")).display_value, "")

    def test_setting_value_changes_fixture_state(self):
        self.ctrl.set_value("Blaa")
        assert_equals(self.fix.name, "Blaa")
        assert_equals(self.fix.args, [])
        self.ctrl.set_value("Blaa | a")
        assert_equals(self.fix.name, "Blaa")
        assert_equals(self.fix.args, ["a"])

    def test_whitespace_is_ignored_in_value(self):
        self.ctrl.set_value("Name |   a    |    b      |     c")
        assert_equals(self.fix.name, "Name")
        assert_equals(self.fix.args, ["a", "b", "c"])
        assert_equals(self.ctrl.display_value, "Name | a | b | c")

    def test_setting_value_informs_parent_controller_about_dirty_model(self):
        self.ctrl.set_value("Blaa")
        assert_true(self.ctrl.dirty)

    def test_set_empty_value(self):
        self.ctrl.set_value("")
        assert_equals(self.fix.name, "")
        assert_equals(self.fix.args, [])
        assert_true(self.ctrl.dirty)

    def test_same_value(self):
        self.ctrl.set_value("My Setup | argh | urgh")
        assert_false(self.ctrl.dirty)

    def test_setting_comment(self):
        self.ctrl.set_comment(["My comment"])
        assert_equals(self.ctrl.comment.as_list(), ["# My comment"])
        assert_true(self.ctrl.dirty)

    def test_contains_keyword_with_regexp_with_empty_fixture(self):
        empty_fixture_controller = FixtureController(self.parent, Fixture("Setup"))
        keyword_regexp = re.compile(r"foo.*bar")
        assert_false(empty_fixture_controller.contains_keyword(keyword_regexp))