Skip to content

Commit cfda62c

Browse files
authored
Use specific filter to ignore only ResourceWarnings in test runs (ev3dev#560)
Also adds instructions for running tests on Micropython.
1 parent 47f1074 commit cfda62c

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

‎.travis.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ git:
1414
depth: 100
1515
install:
1616
- if [ $USE_MICROPYTHON = false ]; then pip install Pillow Sphinx sphinx_bootstrap_theme recommonmark evdev==1.0.0 && pip install -r ./docs/requirements.txt; fi
17-
- if [ $USE_MICROPYTHON = true ]; then ./.travis/install-micropython.sh && PYTHON=~/micropython/ports/unix/micropython; else PYTHON=python3; fi
17+
- if [ $USE_MICROPYTHON = true ]; then ./.travis/install-micropython.sh && MICROPYTHON=~/micropython/ports/unix/micropython; fi
1818
script:
1919
- chmod -R g+rw ./tests/fake-sys/devices/**/*
20-
- if [ $USE_MICROPYTHON = false ]; then $PYTHON -W ignore tests/api_tests.py; fi
21-
- if [ $USE_MICROPYTHON = true ]; then $PYTHON tests/api_tests.py; fi
20+
- if [ $USE_MICROPYTHON = false ]; then python3 -W ignore::ResourceWarning tests/api_tests.py; fi
21+
- if [ $USE_MICROPYTHON = true ]; then $MICROPYTHON tests/api_tests.py; fi
2222
- if [ $USE_MICROPYTHON = false ]; then sphinx-build -nW -b html ./docs/ ./docs/_build/html; fi
2323
deploy:
2424
provider: pypi

‎tests/README.md‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,28 @@ when you git clone. Example:
1111
$ git clone --recursive https://github.com/ev3dev/ev3dev-lang-python.git
1212
```
1313

14-
# Running Tests
15-
To run the tests do:
14+
# Running Tests with CPython (default)
15+
To run the tests:
1616
```
1717
$ cd ev3dev-lang-python/
1818
$ chmod -R g+rw ./tests/fake-sys/devices/**/*
19-
$ python3 -W ignore ./tests/api_tests.py
19+
$ python3 -W ignore::ResourceWarning tests/api_tests.py
20+
```
21+
22+
If on Windows, the `chmod` command can be ignored.
23+
24+
# Running Tests with Micropython
25+
26+
This library also supports a subset of functionality on [Micropython](http://micropython.org/).
27+
28+
You can follow the instructions on [the Micropython wiki](https://github.com/micropython/micropython/wiki/Getting-Started)
29+
or check out our [installation script for Travis CI workers](https://github.com/ev3dev/ev3dev-lang-python/blob/ev3dev-stretch/.travis/install-micropython.sh)
30+
to get Micropython installed. If following the official instructions,
31+
make sure you install the relevant micropython-lib modules listed in the linked script as well.
32+
33+
Once Micropython is installed, you can run the tests with:
34+
35+
```
36+
$ cd ev3dev-lang-python/
37+
$ micropython tests/api_tests.py
2038
```

0 commit comments

Comments
 (0)