Skip to content

Global variables are not explained on failure #171

@pytestbot

Description

@pytestbot

Originally reported by: Floris Bruynooghe (BitBucket: flub, GitHub: flub)


A global variable is not expanded in the explanation on failure:

var = 7

def test_global():
    val = 42
    assert var == val

Results in:

$ py.test test_global.py 
============================= test session starts ==============================
platform linux2 -- Python 2.7.3 -- pytest-2.2.1
collected 1 items 

test_global.py F

=================================== FAILURES ===================================
_________________________________ test_global __________________________________

    def test_global():
        val = 42
>       assert var == val
E       assert var == 42

test_global.py:6: AssertionError
=========================== 1 failed in 0.01 seconds ===========================

I would expect the "E" line to say "assert 7 == 42".


Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions