question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

strange handling of test ids for parametrize

See original GitHub issue
$ cat tests/test_toast.py
import pytest

@pytest.mark.parametrize(
    "ham,spam",
    [
        ("/bacon/../", u"//bacon/../"),
        ("/bacon/../../", u"//bacon/../../"),
        ("/bacon//", u"//bacon//"),
    ],
)
def test_eggs(ham,spam):
    pass
$ pytest -vvv tests/test_eggs.py
==================================== test session starts ====================================
platform linux -- Python 3.7.5, pytest-5.3.2, py-1.8.0, pluggy-0.12.0 -- /home/graingert/.virtualenvs/pytest/bin/python3.7
cachedir: .pytest_cache
rootdir: /home/graingert/projects/sausage/tests, inifile: pytest.ini
collected 3 items                                                                           

tests/test_toast.py::test_eggs[/-/] PASSED                                            [ 33%]
tests/] PASSED                                                                        [ 66%]
tests/test_toast.py::test_eggs[/bacon/-/bacon/] PASSED                                [100%]

===================================== 3 passed in 0.01s =====================================
  • a detailed description of the bug or suggestion
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
graingertcommented, Jan 13, 2020
0reactions
blueyedcommented, Jan 13, 2020

I can reproduce it after touch tests/pytest.ini / touch t/pytest.ini… 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

ids for fixtures and parametrize - pytest-tricks
The following test is parametrized and the id for a test item will be a representation for each individual parameter - joined with...
Read more >
Parameterization – Load Testing with LoadRunner Tutorial #6
This LoadRunner VuGen Parameterization Tutorial will help you to learn ... Examples are session ids/tokens, session states, date values etc.
Read more >
Parametrizing tests — pytest documentation
pytest will build a string that is the test ID for each set of values in a parametrized test. These IDs can be...
Read more >
5 Pytest Best Practices for Writing Great Python Tests
Parametrizing tests and fixtures allows us to generate multiple copies of them easily. ... Use ids to describe individual test cases.
Read more >
pytest Documentation - Read the Docs
How to parametrize fixtures and test functions . ... More info on temporary directory handling is available at Temporary directories and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found