-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix the failure to lint modules contained under an identically named directory #7114
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
It uses epylint to run these tests, but since epylint manipulates cwd, that confounds what is under test
4711f42
to
759d35e
Compare
Pull Request Test Coverage Report for Build 2770829476
π - Coveralls |
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.
Looks pretty good already, I have a question regarding the xfailed test.
@@ -103,9 +105,7 @@ def expand_modules( | |||
) | |||
if filepath is None: | |||
continue | |||
except (ImportError, SyntaxError) as ex: | |||
# The SyntaxError is a Python bug and should be | |||
# removed once we move away from imp.find_module: https://bugs.python.org/issue10588 |
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.
π
@@ -40,6 +41,9 @@ def test_relative_beyond_top_level(self) -> None: | |||
self.checker.visit_importfrom(module.body[2].body[0]) | |||
|
|||
@staticmethod | |||
@pytest.mark.xfail( | |||
reason="epylint manipulates cwd; these tests should not be using epylint" |
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.
Shouldn't we fix it or remove it ? What's the benefit of keeping xfailed tests ?
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.
Yeah, I just didn't want to block this PR on resolving that. All of the tests in that file probably shouldn't be using epylint. Would you like me to open an issue?
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.
Yeah let's open an issue, I'm not sure emacs is used a lot so it's probably not worth a fix, no one read the emacs documentation at least.
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.
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.
Thank you !
with tempdir(): | ||
create_files(["identical/identical.py"]) | ||
with open("identical/identical.py", "w", encoding="utf-8") as f: | ||
f.write("import imp") |
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.
I wonder where the idea for this example came from π
π€ Effect of this PR on checked open source code: π€ Effect on django:
Effect on flask:
Effect on pandas:
Effect on psycopg:
Effect on pytest:
Effect on sentry:
This comment was generated for commit 759d35e |
Type of Changes
Description
Fixes #4444: modules contained under an identically named directory weren't linted (failed with
parse-error
).Notes
This PR causes a test failure in
TestImportsChecker.test_relative_beyond_top_level_two
, but that test usesepylint
to excute pylint (!) which does additional manipulation ofcwd
, so I don't think it's correct.Notice that linting the package in the test fails using regular pylint, but the failure is now more accurate on this branch:
main
PR
$ pylint tests/regrtest_data/beyond_top_two ************* Module tests/regrtest_data/beyond_top_two tests/regrtest_data/beyond_top_two:1:0: F0001: No module named tests/regrtest_data/beyond_top_two (fatal)