Skip to content

Commit 2b966ac

Browse files
authored
Merge pull request #53 from lieryan/lieryan-fix-stray-stdout-from-dmypy
Remove stray output from dmypy
2 parents 7237723 + cba6353 commit 2b966ac

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ repos:
1010
hooks:
1111
- id: rst-linter
1212
- repo: https://github.com/pycqa/isort
13-
rev: 5.10.1
13+
rev: 5.12.0
1414
hooks:
15-
- id: isort
15+
- id: isort

pylsp_mypy/plugin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ def get_diagnostics(
252252
# mypy exists on path
253253
# -> use mypy on path
254254
log.info("executing mypy args = %s on path", args)
255-
completed_process = subprocess.run(
256-
["mypy", *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, **windows_flag
257-
)
255+
completed_process = subprocess.run(["mypy", *args], capture_output=True, **windows_flag)
258256
report = completed_process.stdout.decode()
259257
errors = completed_process.stderr.decode()
260258
exit_status = completed_process.returncode
@@ -275,7 +273,7 @@ def get_diagnostics(
275273
# -> use dmypy on path
276274
completed_process = subprocess.run(
277275
["dmypy", "--status-file", dmypy_status_file, "status"],
278-
stderr=subprocess.PIPE,
276+
capture_output=True,
279277
**windows_flag,
280278
)
281279
errors = completed_process.stderr.decode()
@@ -287,7 +285,9 @@ def get_diagnostics(
287285
errors.strip(),
288286
)
289287
subprocess.run(
290-
["dmypy", "--status-file", dmypy_status_file, "restart"], **windows_flag
288+
["dmypy", "--status-file", dmypy_status_file, "restart"],
289+
capture_output=True,
290+
**windows_flag,
291291
)
292292
else:
293293
# dmypy does not exist on path, but must exist in the env pylsp-mypy is installed in
@@ -310,7 +310,7 @@ def get_diagnostics(
310310
# -> use mypy on path
311311
log.info("dmypy run args = %s via path", args)
312312
completed_process = subprocess.run(
313-
["dmypy", *args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, **windows_flag
313+
["dmypy", *args], capture_output=True, **windows_flag
314314
)
315315
report = completed_process.stdout.decode()
316316
errors = completed_process.stderr.decode()

test/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_option_overrides_dmypy(last_diagnostics_monkeypatch, workspace):
223223
"--show-column-numbers",
224224
document.path,
225225
]
226-
m.assert_called_with(expected, stderr=-1, stdout=-1, **windows_flag)
226+
m.assert_called_with(expected, capture_output=True, **windows_flag)
227227

228228

229229
def test_dmypy_status_file(tmpdir, last_diagnostics_monkeypatch, workspace):

0 commit comments

Comments
 (0)