-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Drop duplicated tests by default #1609 #1756
Conversation
Hey @ioggstream, I'm wondering, in which situations would be useful to drop different tests just because they have the same name? At first I thought this was implementing #1609. |
(At the moment I'm a strong 👎 on this, unless I misunderstood the implementation... it makes it very easy for someone to rename a test in some separate directory to the same name used elsewhere by accident and it will simply skip the second test). |
83fabcc
to
a3c716b
Compare
@nicoddemus fixed to avoid duplicate paths, not names. |
Oh OK, that makes more sense, thanks. 😅 I think dropping duplicated test paths on the command line should be the default behavior as discussed in #1609 though. Would you mind implementing it as such and adding a Also, I think we need a small doc update with the new option. |
I implemented it this way to not change the default behavior. Should I turn it to keep-duplicate? Peace.
|
Yes please. We were planning to do this backward incompatible change eventually, and 3.0 seems like an excellent opportunity to do so. |
def test_real(): | ||
pass | ||
""")) | ||
fpath = fh.strpath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fpath
is unused, which is currently failing the lint test.
d169d77
to
306b87d
Compare
…from the command line. Use --keep-duplicates to retain duplicate paths.
306b87d
to
ab6aef1
Compare
@@ -973,7 +973,7 @@ def pytest_generate_tests(metafunc): | |||
""")) | |||
sub1.join("test_in_sub1.py").write("def test_1(): pass") | |||
sub2.join("test_in_sub2.py").write("def test_2(): pass") | |||
result = testdir.runpytest("-v", "-s", sub1, sub2, sub1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicoddemus @tomviner I had to change this test because the patch changed the default behavior.
Thanks @ioggstream! 👍 |
When using
pytest --skip-duplicates
:purebasename
;