-
-
Notifications
You must be signed in to change notification settings - Fork 154
Fix issue #37 : Create my_path.pth only for local mypy test, remove afterwards #52
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
Dr-Irv
left a comment
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.
Need to only have changes related to fixing the mypy_path.pth file, and account for a possible failure.
scripts/test/procedures.py
Outdated
| subprocess.run(cmd, check=True) | ||
|
|
||
|
|
||
| def add_last_changes(): |
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.
This should be part of a different PR
scripts/test/procedures.py
Outdated
|
|
||
|
|
||
| def run_mypy_dist(): | ||
| create_mypy_pkg_file() |
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.
When testing the distribution, you do NOT want to have this file present, as the distribution is installed
scripts/test/procedures.py
Outdated
| subprocess.run(cmd, check=True) | ||
|
|
||
|
|
||
| def restore_last_changes(): |
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.
should be a different PR
scripts/test/procedures.py
Outdated
| def run_mypy_src(): | ||
| create_mypy_pkg_file() | ||
| cmd = ["mypy", "pandas-stubs", "tests", "--no-incremental"] | ||
| subprocess.run(cmd, check=True) |
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.
If for some reason this fails, the file would still be there. Can't you use the rollback technique you have used elsewhere in case of failure?
scripts/test/__init__.py
Outdated
|
|
||
| steps.extend([ | ||
| Step(name="Create mypy package file", run=procedures.create_mypy_pkg_file), | ||
| Step(name="Run Mypy Against Source Code", run=procedures.run_mypy_src), |
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.
don't you need a rollback here?
scripts/test/procedures.py
Outdated
| from scripts._job import Step, run_job | ||
|
|
||
| def create_mypy_pkg_file(): | ||
| pkg_path = [path for path in sys.path if path.endswith('site-packages')] |
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.
A contextmanager would here also be nice, but I'm not sure whether that fits easily in the structure of having multiple steps.
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 think it could work using tempfile lib, thx.
|
Can you merge with |
Done |
# Conflicts: # pyproject.toml # scripts/test/__init__.py # scripts/test/procedures.py
|
Thanks @BrenoJesusFernandes |
Basically, now
my_path.pthis created and destroyed after tests.Fix #37