-
Notifications
You must be signed in to change notification settings - Fork 769
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
pytest.skip reporting error #438
Comments
Can you provide some sample code that demonstrates this problem? Or if that's not feasible, could you point to a file within a public repo? Without additional details, there's not much we can do with this. |
Sorry, forgot to include the example: import sys
import pytest
if not sys.platform.startswith("win"):
pytest.skip("skipping windows-only tests", allow_module_level=True) That produces the first error. For the second error, if I put the file in a project by itself, I get the first error. Can't figure out what causes the second error. |
@Dr-Irv, tried this and am able to get info on the |
@judej with pylance 2021.1.1 I am still seeing the error where it reports:
|
Irv, I am using pytest 6.2.1 that I pip installed. Which version of pytest do you have? |
@judej I have pytest 6.2.1 as well, installed via conda. Error occurs in environments with python 3.7 and python 3.8 |
@Dr-Irv, could you please add the trace logs? Wondering if we are not looking at the right place for the conda provided libs. |
Here's that output:
|
Weird, it's not looking for pytest at all. Now that I read the output, the name of your file is the same as the name of the pytest module itself, and in an import would be picked up first (as the workspace is an import root before any others). If you rename the file to something else (may need a reload), do things change? |
Renaming it made the problem go away. But I guess that is a bug to be fixed? |
I don't really see that as a bug... If the module name is Does the code you write run? Does a module like this actually exist somewhere, or was it a cut down example for testing? (Moderately related is #253; we effectively assume everything is a module as it's difficult to say that any one file will be a script and will be treated differently.) |
It was a cut down example for testing. But I'm pretty sure that the original code that I had used (from a client - I don't have access any more to it) was showing the same error. Glad we have resolved it. |
Environment data
Expected behaviour
No error
Actual behaviour
reports
In another case, (can't reproduce with a small sample), I get the following:
The text was updated successfully, but these errors were encountered: