Skip to content

3.0: Parametrization gets values from previous tests?! #1832

@The-Compiler

Description

@The-Compiler

So I just updated qutebrowser to pytest 3.0, and did run into a weird issue...

The regular build on AppVeyor works just fine.

For the frozen build tests seem to pick up parametrization values of previous tests?!

For example, near the bottom, this is failing:

tests\unit\config\test_style.py F
_____________________ TestColorDict.test_values[foo-one] ______________________
self = <test_style.TestColorDict object at 0x06FC1130>, key = 'foo'
expected = True
    @pytest.mark.parametrize('key, expected', [
        ('foo', 'one'),
        ('foo.fg', 'two'),
        ('foo.bg', 'three'),
    ])
    def test_values(self, key, expected):
        d = style.ColorDict()
        d['foo'] = 'one'
        d['foo.fg'] = 'two'
        d['foo.bg'] = 'three'
>       assert d[key] == expected
E       assert 'one' == True
tests\unit\config\test_style.py:102: AssertionError

Now where did that True for expected come from? It's certainly not in the parametrized list there...

Then for the next test, suddenly the 'foo' we parametrized for key shows up again:

_________________ TestKeyToString.test_normal[16777495-Blue] __________________
self = <test_utils.TestKeyToString object at 0x071731D0>, key = 'foo'
expected = True
    @pytest.mark.parametrize('key, expected', [
        (Qt.Key_Blue, 'Blue'),
        (Qt.Key_Backtab, 'Tab'),
        (Qt.Key_Escape, 'Escape'),
        (Qt.Key_A, 'A'),
        (Qt.Key_degree, '�'),
        (Qt.Key_Meta, 'Meta'),
    ])
    def test_normal(self, key, expected):
        """Test a special key where QKeyEvent::toString works incorrectly."""
>       assert utils.key_to_string(key) == expected
E       assert '' == True
E        +  where '' = <function key_to_string at 0x039CC810>('foo')
E        +    where <function key_to_string at 0x039CC810> = utils.key_to_string
tests\unit\utils\test_utils.py:451: AssertionError

here, key never should be 'foo' and expected never should be True...

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions