Skip to content

Make it work on Windows #14

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

Merged
merged 2 commits into from
Dec 12, 2019
Merged

Make it work on Windows #14

merged 2 commits into from
Dec 12, 2019

Conversation

selimb
Copy link
Contributor

@selimb selimb commented Dec 10, 2019

Remove capturer dependency: use contextlib.redirect_* instead.
Also fixed some other minor issues

See #13

@@ -180,12 +189,10 @@ def typecheck_in_same_process(self, execution_path: Path, mypy_cmd_options: List
# add current directory to path
sys.path.insert(0, str(execution_path))

with capturer.CaptureOutput(merged=False) as captured_std_streams:
with capture_std_streams() as (stdout, stderr):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI, I believe I noticed typecheck_in_same_process isn't covered by the tests

@@ -3,5 +3,5 @@
# if hook works, main should contain 'reveal_type(1)'
reveal_type: 1
out: |
main:1: note: Revealed type is 'builtins.int'
main:1: note: Revealed type is 'Literal[1]'
Copy link
Contributor Author

@selimb selimb Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned it in the commit, but I needed to change this so that the tests would pass on the latest mypy version (0.750). Was failing on Travis as well: https://travis-ci.com/typeddjango/pytest-mypy-plugins/jobs/265800510

@@ -163,6 +167,9 @@ def typecheck_in_new_subprocess(self, execution_path: Path, mypy_cmd_options: Li

# add current directory to path
self.environment_variables['PYTHONPATH'] = str(execution_path)
# Windows requires this to be set, otherwise the interpreter crashes
if 'SYSTEMROOT' in os.environ:
self.environment_variables['SYSTEMROOT'] = os.environ['SYSTEMROOT']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, just found out this is documented in subprocess.Popen

@mkurnikov mkurnikov merged commit a2c3fc0 into typeddjango:master Dec 12, 2019
@mkurnikov
Copy link
Member

mkurnikov commented Dec 12, 2019

@selimb Thanks! I'm going to finish #12 and make a release out of it in a couple of days.

@selimb
Copy link
Contributor Author

selimb commented Dec 12, 2019

@mkurnikov Welcome! Thanks for your work on this.

griels pushed a commit to griels/pytest-mypy-plugins that referenced this pull request Dec 19, 2024
* make it work on Windows. ditch capturer.

* fix test for mypy==0.750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants