Skip to content

tests: rename run-tests to run-tests.py and format with black, for consistency #7014

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
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/ports_unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: source tools/ci.sh && ci_unix_minimal_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

reproducible:
runs-on: ubuntu-latest
Expand All @@ -49,7 +49,7 @@ jobs:
run: source tools/ci.sh && ci_unix_standard_run_perfbench
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

coverage:
runs-on: ubuntu-latest
Expand All @@ -76,7 +76,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

coverage_32bit:
runs-on: ubuntu-latest
Expand All @@ -94,7 +94,7 @@ jobs:
run: source tools/ci.sh && ci_unix_coverage_32bit_run_native_mpy_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

nanbox:
runs-on: ubuntu-latest
Expand All @@ -108,7 +108,7 @@ jobs:
run: source tools/ci.sh && ci_unix_nanbox_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

float:
runs-on: ubuntu-latest
Expand All @@ -120,7 +120,7 @@ jobs:
run: source tools/ci.sh && ci_unix_float_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

stackless_clang:
runs-on: ubuntu-20.04
Expand All @@ -134,7 +134,7 @@ jobs:
run: source tools/ci.sh && ci_unix_stackless_clang_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

float_clang:
runs-on: ubuntu-20.04
Expand All @@ -148,7 +148,7 @@ jobs:
run: source tools/ci.sh && ci_unix_float_clang_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

settrace:
runs-on: ubuntu-latest
Expand All @@ -160,7 +160,7 @@ jobs:
run: source tools/ci.sh && ci_unix_settrace_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

settrace_stackless:
runs-on: ubuntu-latest
Expand All @@ -172,7 +172,7 @@ jobs:
run: source tools/ci.sh && ci_unix_settrace_stackless_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures

macos:
runs-on: macos-11.0
Expand All @@ -185,4 +185,4 @@ jobs:
run: source tools/ci.sh && ci_unix_macos_run_tests
- name: Print failures
if: failure()
run: tests/run-tests --print-failures
run: tests/run-tests.py --print-failures
2 changes: 1 addition & 1 deletion docs/develop/gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ To run a selection of tests on a board/device connected over USB use:
.. code-block:: bash

$ cd tests
$ ./run-tests --target minimal --device /dev/ttyACM0
$ ./run-tests.py --target minimal --device /dev/ttyACM0

See also :ref:`writingtests`.

Expand Down
12 changes: 6 additions & 6 deletions docs/develop/writingtests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Writing tests
=============

Tests in MicroPython are located at the path ``tests/``. The following is a listing of
key directories and the run-tests runner script:
key directories and the run-tests.py runner script:

.. code-block:: bash

Expand All @@ -13,7 +13,7 @@ key directories and the run-tests runner script:
├── extmod
├── float
├── micropython
├── run-tests
├── run-tests.py
...

There are subfolders maintained to categorize the tests. Add a test by creating a new file in one of the
Expand Down Expand Up @@ -54,17 +54,17 @@ The other way to run tests, which is useful when running on targets other than t
.. code-block:: bash

$ cd tests
$ ./run-tests
$ ./run-tests.py

Then to run on a board:

.. code-block:: bash

$ ./run-tests --target minimal --device /dev/ttyACM0
$ ./run-tests.py --target minimal --device /dev/ttyACM0

And to run only a certain set of tests (eg a directory):

.. code-block:: bash

$ ./run-tests -d basics
$ ./run-tests float/builtin*.py
$ ./run-tests.py -d basics
$ ./run-tests.py float/builtin*.py
2 changes: 1 addition & 1 deletion ports/cc3200/tools/smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""
Execute it like this:

python3 run-tests --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py
python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py
"""

pin_map = [23, 24, 11, 12, 13, 14, 15, 16, 17, 22, 28, 10, 9, 8, 7, 6, 30, 31, 3, 0, 4, 5]
Expand Down
4 changes: 2 additions & 2 deletions ports/javascript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ $(BUILD)/micropython.js: $(OBJ) library.js wrapper.js
min: $(BUILD)/micropython.js
uglifyjs $< -c -o $(BUILD)/micropython.min.js

test: $(BUILD)/micropython.js $(TOP)/tests/run-tests
test: $(BUILD)/micropython.js $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../ports/javascript/node_run.sh ./run-tests
cd $(TOP)/tests && MICROPY_MICROPYTHON=../ports/javascript/node_run.sh ./run-tests.py

include $(TOP)/py/mkrules.mk
2 changes: 1 addition & 1 deletion ports/qemu-arm/Makefile.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CFLAGS += -DTEST

$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
$(BUILD)/genhdr/tests.h:
(cd $(TOP)/tests; ./run-tests --target=qemu-arm --write-exp)
(cd $(TOP)/tests; ./run-tests.py --target=qemu-arm --write-exp)
$(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py) > $@

$(BUILD)/lib/tinytest/tinytest.o: CFLAGS += -DNO_FORKING
Expand Down
16 changes: 8 additions & 8 deletions ports/unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,17 @@ include $(TOP)/py/mkrules.mk

.PHONY: test test_full

test: $(PROG) $(TOP)/tests/run-tests
test: $(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py

test_full: $(PROG) $(TOP)/tests/run-tests
test_full: $(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests -d thread
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --emit native
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py -d thread
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --emit native
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
cat $(TOP)/tests/basics/0prelim.py | ./$(PROG) | grep -q 'abc'

test_gcov: test_full
Expand Down
14 changes: 7 additions & 7 deletions ports/windows/.appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ build:
test_script:
- ps: |
cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'tests')
& $env:MICROPY_CPYTHON3 run-tests
& $env:MICROPY_CPYTHON3 run-tests.py
if ($LASTEXITCODE -ne 0) {
& $env:MICROPY_CPYTHON3 run-tests --print-failures
& $env:MICROPY_CPYTHON3 run-tests.py --print-failures
throw "Test failure"
}
& $env:MICROPY_CPYTHON3 run-tests --via-mpy -d basics float micropython
& $env:MICROPY_CPYTHON3 run-tests.py --via-mpy -d basics float micropython
if ($LASTEXITCODE -ne 0) {
& $env:MICROPY_CPYTHON3 run-tests --print-failures
& $env:MICROPY_CPYTHON3 run-tests.py --print-failures
throw "Test failure"
}

Expand All @@ -71,17 +71,17 @@ after_test:
throw "$env:MSYSTEM mpy_cross build exited with code $LASTEXITCODE"
}
cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'tests')
$testArgs = @('run-tests')
$testArgs = @('run-tests.py')
foreach ($skipTest in @('math_fun', 'float2int_double', 'float_parse', 'math_domain_special')) {
$testArgs = $testArgs + '-e' + $skipTest
}
& $env:MICROPY_CPYTHON3 $testArgs
if ($LASTEXITCODE -ne 0) {
& $env:MICROPY_CPYTHON3 run-tests --print-failures
& $env:MICROPY_CPYTHON3 run-tests.py --print-failures
throw "Test failure"
}
& $env:MICROPY_CPYTHON3 ($testArgs + @('--via-mpy', '-d', 'basics', 'float', 'micropython'))
if ($LASTEXITCODE -ne 0) {
& $env:MICROPY_CPYTHON3 run-tests --print-failures
& $env:MICROPY_CPYTHON3 run-tests.py --print-failures
throw "Test failure"
}
4 changes: 2 additions & 2 deletions ports/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ Running the tests
This is similar for all ports:

cd ../../tests
python ./run-tests
python ./run-tests.py

Though when running on Cygwin and using Cygwin's Python installation you'll need:

python3 ./run-tests
python3 ./run-tests.py

Depending on the combination of platform and Python version used it might be
needed to first set the MICROPY_MICROPYTHON environment variable to
Expand Down
4 changes: 2 additions & 2 deletions ports/zephyr/make-bin-testsuite
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# ./make-bin-testsuite BOARD=qemu_cortex_m3 run
#

(cd ../../tests; ./run-tests --write-exp)
(cd ../../tests; ./run-tests --list-tests --target=minimal \
(cd ../../tests; ./run-tests.py --write-exp)
(cd ../../tests; ./run-tests.py --list-tests --target=minimal \
-e async -e intbig -e int_big -e builtin_help -e memstats -e bytes_compare3 -e class_reverse_op \
-e /set -e frozenset -e complex -e const -e native -e viper \
-e 'float_divmod\.' -e float_parse_doubleprec -e float/true_value -e float/types \
Expand Down
6 changes: 3 additions & 3 deletions tests/README
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
This directory contains tests for various functionality areas of MicroPython.
To run all stable tests, run "run-tests" script in this directory.
To run all stable tests, run "run-tests.py" script in this directory.

Tests of capabilities not supported on all platforms should be written
to check for the capability being present. If it is not, the test
should merely output 'SKIP' followed by the line terminator, and call
sys.exit() to raise SystemExit, instead of attempting to test the
missing capability. The testing framework (run-tests in this
missing capability. The testing framework (run-tests.py in this
directory, test_main.c in qemu_arm) recognizes this as a skipped test.

There are a few features for which this mechanism cannot be used to
condition a test. The run-tests script uses small scripts in the
condition a test. The run-tests.py script uses small scripts in the
feature_check directory to check whether each such feature is present,
and skips the relevant tests if not.

Expand Down
2 changes: 1 addition & 1 deletion tests/esp32/partition_ota.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def copy_partition(src, dest):
if sz - addr < 4096:
blk = blk[: sz - addr]
if addr & 0xFFFF == 0:
# need to show progress to run-tests else it times out
# need to show progress to run-tests.py else it times out
print(" ... 0x{:06x}".format(addr))
src.readblocks(addr >> 12, blk)
dest.writeblocks(addr >> 12, blk)
Expand Down
2 changes: 1 addition & 1 deletion tests/feature_check/README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This directory doesn't contain real tests, but code snippets to detect
various interpreter features, which can't be/inconvenient to detecte by
other means. Scripts here are executed by run-tests at the beginning of
other means. Scripts here are executed by run-tests.py at the beginning of
testsuite to decide what other test groups to run/exclude.
2 changes: 1 addition & 1 deletion tests/jni/README
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ of JVM.

For example, for OpenJDK 7 on x86_64, following may work:

LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py
LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests.py jni/*.py

2 changes: 1 addition & 1 deletion tests/net_hosted/README
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ not yet fully correspond to the functional specification above.
So far, these tests are not run as part of the main testsuite and need
to be run seperately (from the main test/ directory):

./run-tests net_hosted/*.py
./run-tests.py net_hosted/*.py
2 changes: 1 addition & 1 deletion tests/net_inet/README
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ This directory contains network tests which require Internet connection.
Note that these tests are not run as part of the main testsuite and need
to be run seperately (from the main test/ directory):

./run-tests net_inet/*.py
./run-tests.py net_inet/*.py
2 changes: 1 addition & 1 deletion tests/run-internalbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def main():
cmd_parser.add_argument("files", nargs="*", help="input test files")
args = cmd_parser.parse_args()

# Note pyboard support is copied over from run-tests, not testes, and likely needs revamping
# Note pyboard support is copied over from run-tests.py, not tests, and likely needs revamping
if args.pyboard:
import pyboard

Expand Down
Loading