-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not work with parametrized nodeids #21
Comments
does this happen in older pytest versions ? |
For instance: ``` @pytest.mark.repeat(1) def test_heavy(): pass ``` When ran with `py.test --count 10`, this doesn't crash anymore and runs the test once.
It happens in older pytest versions as well (at least until 2.8) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Any progress on this? |
Hey, looks like this happens on the latest pytest version |
This is happening for me with pytest 7.1.0 and pytest-repeat 0.9.1. Is it related to the way test items are renamed and collected, in that For example, with a parametrized test that has one parameter of value
And this works (runs 1000 times but for each parameter, which may be far too many tests):
But to run for a single parameter value, this does not work:
And this runs once, but does not repeat:
Is there a known workaround, aside from running |
I'm curious if there's been any thinking from the contributors as to how this might work, if we could get it to work? I come across this so often I'd be happy to help fix it, if I could get in sync with the designers' thoughts... |
Currently no design work on this was done I believe major internals Changes in pytest itself are necessary to enable this |
Seems to work fine now, with pytest 7.4.2 and pytest-repeat 0.9.2 import pytest
@pytest.mark.parametrize('a', (10, 20))
def test_foo(a):
... test run:
|
@okken I think the issue remains and it’s that you can’t do this:
|
This one is unfixable without a major change in pytest |
The act of using There is a workaround, selecting parameters by keyword instead of nodeid:
|
We also cannot select individual counts using nodeid:
I don't think this is a bug, it's an affect of when the counts are added to the nodeid. And there is the same workaround, use keywords.
|
@RonnyPfannschmidt this brings me to a question of "why leave this issue open?"
So why keep this open? |
Also just swapped "bug" for "enhancement", because there is a way to do the requested action, just not with the desired syntax. |
I'd like to turn this into a feature request for pytest |
I personally wouldn't know how to describe the feature request. Partly because I don't fully understand the limitations of pytest that are the problem. But I agree. I do think, at the very least, this issue should remain open until the workaround is documented and easy to find. |
@DavidAntliff Does the |
Yes, that works for me - thank you. I've been looking for a way to do this for a while. |
pytest tests/test_database.py::TestDatabaseFixtures::test_access\[db\]
works, but adding--count 10
fails:pytest version 3.6.3.dev5+gb7b9c54d
The text was updated successfully, but these errors were encountered: