Ejemplo n.º 1
0
def test_totals_true():
    """results.Totals: bool() returns True when any value is not 0"""
    # This might deserve a generator, but it seems so simple that it it's a lot
    # of work for no gain
    for key in six.iterkeys(results.Totals()):
        test = results.Totals()
        test[key] += 1
        nt.ok_(bool(test), msg='Returns false with status {}'.format(key))
Ejemplo n.º 2
0
 def test_root(self):
     """results.TestrunResult.totals: The root is correct with subtests"""
     expect = results.Totals()
     expect['pass'] += 1
     expect['crash'] += 1
     expect['fail'] += 1
     dict_eq(self.test['root'], expect)
Ejemplo n.º 3
0
 def test_node_values(self):
     """results.TestrunResult.totals: Tests with subtests values are correct"""
     expect = results.Totals()
     expect['pass'] += 1
     expect['crash'] += 1
     expect['fail'] += 1
     dict_eq(self.test[grouptools.join('sub', 'test')], expect)
Ejemplo n.º 4
0
 def test_recurse(self):
     """results.TestrunResult.totals: Recurses correctly"""
     expected = results.Totals()
     expected['fail'] += 1
     expected['crash'] += 1
     expected['skip'] += 1
     dict_eq(self.test['foo'], expected)
Ejemplo n.º 5
0
 def test_root(self):
     """The root is correct with subtests."""
     expect = results.Totals()
     expect['pass'] += 1
     expect['crash'] += 1
     expect['fail'] += 1
     assert dict(self.test['root']) == dict(expect)
Ejemplo n.º 6
0
 def test_two_parents(self):
     """Handles multiple parents correctly."""
     expected = results.Totals()
     expected['crash'] += 1
     expected['skip'] += 1
     assert dict(self.test[grouptools.join('foo', 'foo')]) == \
         dict(expected)
Ejemplo n.º 7
0
 def test_recurse(self):
     """Recurses correctly."""
     expected = results.Totals()
     expected['fail'] += 1
     expected['crash'] += 1
     expected['skip'] += 1
     assert dict(self.test['foo']) == dict(expected)
Ejemplo n.º 8
0
 def test_node_values(self):
     """Tests with subtests values are correct."""
     expect = results.Totals()
     expect['pass'] += 1
     expect['crash'] += 1
     expect['fail'] += 1
     assert dict(self.test[grouptools.join('sub', 'test')]) == \
         dict(expect)
Ejemplo n.º 9
0
    def test_root(self):
        """results.TestrunResult.totals: The root is correct"""
        root = results.Totals()
        root['pass'] += 1
        root['fail'] += 1
        root['crash'] += 1
        root['skip'] += 1

        dict_eq(self.test['root'], root)
Ejemplo n.º 10
0
        def test_root(self):
            """The root is correct."""
            root = results.Totals()
            root['pass'] += 1
            root['fail'] += 1
            root['crash'] += 1
            root['skip'] += 1

            assert dict(self.test['root']) == dict(root)
Ejemplo n.º 11
0
class TestTotals(object):
    """Tests for the totals class."""
    def test_totals_false(self):
        """bool() returns False when all values are 0."""
        assert not bool(results.Totals())

    # The tuple is required because of the timeout status, which conflicts with
    # the timeout pylint plugin
    @pytest.mark.parametrize("key", ((x, ) for x in results.Totals().keys()))
    def test_totals_true(self, key):
        """bool() returns True when any value is not 0."""
        test = results.Totals()
        test[key[0]] += 1
        assert bool(test)
Ejemplo n.º 12
0
def test_totals_false():
    """results.Totals: bool() returns False when all values are 0"""
    nt.ok_(not bool(results.Totals()))
Ejemplo n.º 13
0
 def test_two_parents(self):
     """results.TestrunResult.totals: Handles multiple parents correctly"""
     expected = results.Totals()
     expected['crash'] += 1
     expected['skip'] += 1
     dict_eq(self.test[grouptools.join('foo', 'foo')], expected)
Ejemplo n.º 14
0
 def test_totals_true(self, key):
     """bool() returns True when any value is not 0."""
     test = results.Totals()
     test[key[0]] += 1
     assert bool(test)
Ejemplo n.º 15
0
 def test_totals_false(self):
     """bool() returns False when all values are 0."""
     assert not bool(results.Totals())