|
33 | 33 | import re |
34 | 34 | from collections import namedtuple |
35 | 35 |
|
| 36 | +# Micropython supports syntax of CPython 3.4 with some features from 3.5, and |
| 37 | +# such version should be used to test for differences. If your default python3 |
| 38 | +# executable is of lower version, you can point MICROPY_CPYTHON3 environment var |
| 39 | +# to the correct executable. |
| 40 | +if os.name == 'nt': |
| 41 | + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') |
| 42 | + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../windows/micropython.exe') |
| 43 | +else: |
| 44 | + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') |
| 45 | + MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../unix/micropython') |
| 46 | + |
36 | 47 | TESTPATH = '../tests/cpydiff/' |
37 | | -UPYPATH = '../unix/micropython' |
38 | 48 | DOCPATH = '../docs/genrst/' |
39 | 49 | INDEXTEMPLATE = '../docs/differences/index_template.txt' |
40 | 50 | INDEX = 'index.rst' |
@@ -84,10 +94,10 @@ def run_tests(tests): |
84 | 94 | input_cpy = f.read() |
85 | 95 | input_upy = uimports(input_cpy) |
86 | 96 |
|
87 | | - process = subprocess.Popen('python', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) |
| 97 | + process = subprocess.Popen(CPYTHON3, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) |
88 | 98 | output_cpy = [com.decode('utf8') for com in process.communicate(input_cpy)] |
89 | 99 |
|
90 | | - process = subprocess.Popen(UPYPATH, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) |
| 100 | + process = subprocess.Popen(MICROPYTHON, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) |
91 | 101 | output_upy = [com.decode('utf8') for com in process.communicate(input_upy)] |
92 | 102 |
|
93 | 103 | if output_cpy[0] == output_upy[0] and output_cpy[1] == output_upy[1]: |
|
0 commit comments