-
-
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
py 1.8.2 breaks collect-only package printing on windows #7477
Comments
Do this literal example reproduce? I'm asking because the change in py 1.8.2 has to do with case-insensitivity in paths, and in your example everything is lower case. So just want to make sure before I examine this issue. |
Here's a zip file with folder structure that can reproduce this. |
|
When I moved the files from windows to Mac it omitted the init files. |
There's also comparison of 1.8.1 and 1.8.2 output of pytest tests --collect-only |
I tried to reproduce this what I have available but failed. When I get a chance I'll try it on a windows machine, but until then if someone can provide a test case that would fail on pytest CI that would be ideal. In any case, this bug likely belongs in pytest, not in py, because the py patch fixes a real correctness bug, but maybe something in pytest relied on the broken behavior... |
Just to clarify - this happens only on windows, so if you tried reproducing on different platform it would not happen. Could you point to where such a test case could go? I am not sure if I will find the time, but I could try adding this test case to pytest CI. |
You can start by cloning the pytest git repository to your computer, apply the following diff: diff --git a/testing/test_terminal.py b/testing/test_terminal.py
index f1481dce5..e1758fa57 100644
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -424,6 +424,30 @@ class TestCollectonly:
]
)
+ def test_collectonly_windows_bug(self, testdir: Testdir) -> None:
+ p = testdir.makepyfile(
+ **{
+ "__init__": "",
+ "tests/__init__": "",
+ "tests/folder_1/__init__": "",
+ "tests/folder_2/__init__": "",
+ "tests/folder_2/subfolder_1/__init__": "",
+ "tests/folder_2/subfolder_1/test_module": """
+ def test_something(): pass
+ """,
+ }
+ )
+ result = testdir.runpytest("--collect-only")
+ assert result.ret == 0
+ result.stdout.fnmatch_lines(
+ [
+ "<Package subfolder_1>",
+ " <Module test_module.py>",
+ " <Function test_something>",
+ ],
+ consecutive=True,
+ )
+
def test_collectonly_error(self, testdir):
p = testdir.makepyfile("import Errlkjqweqwe")
result = testdir.runpytest("--collect-only", p) and run this test from the pytest repo like this:
Then modify it until it demonstrates a difference of behavior between
|
Likely affected by https://github.com/pytest-dev/py/issues/245.
Likely affected by https://github.com/pytest-dev/py/issues/245.
This comment has been minimized.
This comment has been minimized.
Actually I get the same behavior on This is what I get in
And here in
And I get the exact same output in (My comment in #7477 (comment) was incorrect). Notice that the same packages are still being collected, only their So I'm not sure, it seems everything is working as intended. @KrzysztofMurawski can you elaborate on what problem you are having? |
@nicoddemus You might also want to ask the Microsoft VS Code people who ran into the issue here: microsoft/vscode-python#12372 |
Managed to understand the problem, but not sure how to proceed: microsoft/vscode-python#12372 (comment) |
I did not think of this possibility, that explains why no matter what I tried I couldn't reproduce it. It will be interesting to bisect this, not sure I will get to it myself though (maybe). |
Closing for now as this has been fixed in |
When having a tests directory that contains subfolders with each containing some tests:
e.g.
collect only always only reports Package as tests
e.g.:
1.8.1 on windows and 1.8.2 on Darwin / linux would do this:
e.g.:
The text was updated successfully, but these errors were encountered: