Skip to content

Commit 103eeff

Browse files
committed
tests/run-tests: Skip running feature checks for --list-tests/--write-exp.
The whole idea of --list-tests is that we prepare a list of tests to run later, and currently don't have a connection to target board. Similarly for --write-exp - only "python3" binary would be required for this operation, not "micropython".
1 parent 4475f32 commit 103eeff

1 file changed

Lines changed: 50 additions & 42 deletions

File tree

tests/run-tests

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -211,48 +211,56 @@ def run_tests(pyb, tests, args, base_path="."):
211211
skip_async = False
212212
skip_const = False
213213
skip_revops = False
214-
215-
# Check if micropython.native is supported, and skip such tests if it's not
216-
output = run_feature_check(pyb, args, base_path, 'native_check.py')
217-
if output == b'CRASH':
218-
skip_native = True
219-
220-
# Check if arbitrary-precision integers are supported, and skip such tests if it's not
221-
output = run_feature_check(pyb, args, base_path, 'int_big.py')
222-
if output != b'1000000000000000000000000000000000000000000000\n':
223-
skip_int_big = True
224-
225-
# Check if set type (and set literals) is supported, and skip such tests if it's not
226-
output = run_feature_check(pyb, args, base_path, 'set_check.py')
227-
if output == b'CRASH':
228-
skip_set_type = True
229-
230-
# Check if async/await keywords are supported, and skip such tests if it's not
231-
output = run_feature_check(pyb, args, base_path, 'async_check.py')
232-
if output == b'CRASH':
233-
skip_async = True
234-
235-
# Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not
236-
output = run_feature_check(pyb, args, base_path, 'const.py')
237-
if output == b'CRASH':
238-
skip_const = True
239-
240-
# Check if __rOP__ special methods are supported, and skip such tests if it's not
241-
output = run_feature_check(pyb, args, base_path, 'reverse_ops.py')
242-
if output == b'TypeError\n':
243-
skip_revops = True
244-
245-
# Check if emacs repl is supported, and skip such tests if it's not
246-
t = run_feature_check(pyb, args, base_path, 'repl_emacs_check.py')
247-
if not 'True' in str(t, 'ascii'):
248-
skip_tests.add('cmdline/repl_emacs_keys.py')
249-
250-
upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py')
251-
upy_float_precision = int(run_feature_check(pyb, args, base_path, 'float.py'))
252-
has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n'
253-
has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n'
254-
cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py'])
255-
skip_endian = (upy_byteorder != cpy_byteorder)
214+
skip_endian = False
215+
has_complex = True
216+
has_coverage = False
217+
218+
upy_float_precision = 32
219+
220+
# If we're asked to --list-tests, we can't assume that there's a
221+
# connection to target, so we can't run feature checks usefully.
222+
if not (args.list_tests or args.write_exp):
223+
# Check if micropython.native is supported, and skip such tests if it's not
224+
output = run_feature_check(pyb, args, base_path, 'native_check.py')
225+
if output == b'CRASH':
226+
skip_native = True
227+
228+
# Check if arbitrary-precision integers are supported, and skip such tests if it's not
229+
output = run_feature_check(pyb, args, base_path, 'int_big.py')
230+
if output != b'1000000000000000000000000000000000000000000000\n':
231+
skip_int_big = True
232+
233+
# Check if set type (and set literals) is supported, and skip such tests if it's not
234+
output = run_feature_check(pyb, args, base_path, 'set_check.py')
235+
if output == b'CRASH':
236+
skip_set_type = True
237+
238+
# Check if async/await keywords are supported, and skip such tests if it's not
239+
output = run_feature_check(pyb, args, base_path, 'async_check.py')
240+
if output == b'CRASH':
241+
skip_async = True
242+
243+
# Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not
244+
output = run_feature_check(pyb, args, base_path, 'const.py')
245+
if output == b'CRASH':
246+
skip_const = True
247+
248+
# Check if __rOP__ special methods are supported, and skip such tests if it's not
249+
output = run_feature_check(pyb, args, base_path, 'reverse_ops.py')
250+
if output == b'TypeError\n':
251+
skip_revops = True
252+
253+
# Check if emacs repl is supported, and skip such tests if it's not
254+
t = run_feature_check(pyb, args, base_path, 'repl_emacs_check.py')
255+
if not 'True' in str(t, 'ascii'):
256+
skip_tests.add('cmdline/repl_emacs_keys.py')
257+
258+
upy_byteorder = run_feature_check(pyb, args, base_path, 'byteorder.py')
259+
upy_float_precision = int(run_feature_check(pyb, args, base_path, 'float.py'))
260+
has_complex = run_feature_check(pyb, args, base_path, 'complex.py') == b'complex\n'
261+
has_coverage = run_feature_check(pyb, args, base_path, 'coverage.py') == b'coverage\n'
262+
cpy_byteorder = subprocess.check_output([CPYTHON3, base_path + '/feature_check/byteorder.py'])
263+
skip_endian = (upy_byteorder != cpy_byteorder)
256264

257265
# Some tests shouldn't be run under Travis CI
258266
if os.getenv('TRAVIS') == 'true':

0 commit comments

Comments
 (0)