Skip to content
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ install:
- if [ $USE_MICROPYTHON = true ]; then ./.travis/install-micropython.sh && PYTHON=~/micropython/ports/unix/micropython; else PYTHON=python3; fi
script:
- chmod -R g+rw ./tests/fake-sys/devices/**/*
- $PYTHON tests/api_tests.py
- if [ $USE_MICROPYTHON = false ]; then $PYTHON -W ignore tests/api_tests.py; fi
Comment thread
dwalton76 marked this conversation as resolved.
Resolved
- if [ $USE_MICROPYTHON = true ]; then $PYTHON tests/api_tests.py; fi
- if [ $USE_MICROPYTHON = false ]; then sphinx-build -nW -b html ./docs/ ./docs/_build/html; fi
deploy:
provider: pypi
Expand Down
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
python-ev3dev2 (2.0.0~beta3) stable; urgency=medium

* suppress unittest ResourceWarning messages
* Added DistanceValue classes
* wait_until_not_moving should consider "running holding" as "not moving"
* brickpi(3) raise exception if LargeMotor not used for a motor
Expand Down
15 changes: 4 additions & 11 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@ already cloned the ev3dev-lang-python repo you can use the `--recursive` option
when you git clone. Example:

```
$ git clone --recursive https://github.com/rhempel/ev3dev-lang-python.git
$ git clone --recursive https://github.com/ev3dev/ev3dev-lang-python.git
```

# Running Tests
To run the tests do:
```
$ ./api_tests.py
```

# Misc
Commands used to copy the /sys/class node:
Comment thread
dwalton76 marked this conversation as resolved.
Resolved

```
$ node=lego-sensor/sensor0
$ mkdir -p ./${node}
$ cp -P --copy-contents -r /sys/class/${node}/* ./${node}/
$ cd ev3dev-lang-python/
$ chmod -R g+rw ./tests/fake-sys/devices/**/*
Comment thread
dwalton76 marked this conversation as resolved.
Resolved
$ python3 -W ignore ./tests/api_tests.py
```
16 changes: 14 additions & 2 deletions tests/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from ev3dev2.motor import \
Motor, MediumMotor, LargeMotor, \
MoveTank, MoveSteering, MoveJoystick, \
SpeedPercent, SpeedDPM, SpeedDPS, SpeedRPM, SpeedRPS, SpeedNativeUnits, \
OUTPUT_A, OUTPUT_B
SpeedPercent, SpeedDPM, SpeedDPS, SpeedRPM, SpeedRPS, SpeedNativeUnits

from ev3dev2.unit import (
DistanceMillimeters,
DistanceCentimeters,
Expand All @@ -27,6 +27,10 @@
DistanceStuds
)

# We force OUTPUT_A and OUTPUT_B to be imported from platform "fake" so that
# we can run these test cases on an EV3, brickpi3, etc.
from ev3dev2._platform.fake import OUTPUT_A, OUTPUT_B

ev3dev2.Device.DEVICE_ROOT_PATH = os.path.join(FAKE_SYS, 'arena')

_internal_set_attribute = ev3dev2.Device._set_attribute
Expand All @@ -53,6 +57,14 @@ def dummy_wait(self, cond, timeout=None):
Motor.wait = dummy_wait

class TestAPI(unittest.TestCase):

def setUp(self):
# micropython does not have _testMethodName
try:
print("\n\n{}\n{}".format(self._testMethodName, "=" * len(self._testMethodName,)))
except AttributeError:
pass
Comment thread
dwalton76 marked this conversation as resolved.
Resolved

def test_device(self):
clean_arena()
populate_arena([('medium_motor', 0, 'outA'), ('infrared_sensor', 0, 'in1')])
Expand Down