Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c47511f

Browse files
authored
Use sys.executable for invoking mypy in runtests if it is >=Python 3.4 (#5702)
1 parent 1e096f7 commit c47511f

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,12 @@ whenever you change branches, merge, rebase, or pull.
221221
Tests
222222
-----
223223

224-
See [Test README.md](test-data/unit/README.md)
224+
The basic way to run tests:
225+
226+
$ pip3 install -r test-requirements.txt
227+
$ ./runtests.py
228+
229+
For more on the tests, see [Test README.md](test-data/unit/README.md)
225230

226231

227232
Development status

runtests.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
#!/usr/bin/env python3
22
from os import system
3-
from sys import argv, exit, platform
3+
from sys import argv, exit, platform, executable, version_info
44

55
prog, *args = argv
66

7-
if platform == 'win32':
8-
python_name = 'py -3'
7+
8+
# Use the Python provided to execute the script, or fall back to a sane default
9+
if version_info >= (3, 4, 0):
10+
python_name = executable
911
else:
10-
python_name = 'python3'
12+
if platform == 'win32':
13+
python_name = 'py -3'
14+
else:
15+
python_name = 'python3'
1116

1217
cmds = {
1318
'self': python_name + ' -m mypy --config-file mypy_self_check.ini -p mypy',

0 commit comments

Comments
 (0)