Created
August 23, 2016 22:32
-
-
Save okken/7dd34e0fe0086788412d800213bf6cf1 to your computer and use it in GitHub Desktop.
pytest paramterized ids cannot be integers. They could in 2.9.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mport pytest | |
# ----------------------------------------- | |
# To Demonstrate numerical ids not working | |
# ----------------------------------------- | |
testdata = [( 1, 2), ( 2, 4)] | |
def times_2(x): | |
return x * 2 | |
@pytest.mark.parametrize("x,expected", testdata, ids=('a','b')) | |
def test_ids_strings(x,expected): | |
'''works in both 3.0.0 and 2.9.2''' | |
assert times_2(x) == expected | |
@pytest.mark.parametrize("x,expected", testdata, ids=(1,2)) | |
def test_ids_numbers(x,expected): | |
'''works in 2.9.2, crashes verbosely in 3.0.0''' | |
assert times_2(x) == expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment