From ec311216db0d495285071c93883fbfa72fcf5c78 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Tue, 7 Dec 2021 08:44:36 -0800 Subject: [PATCH 1/2] fix formatting for running tests --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index da1ba96..7c5c536 100644 --- a/README.md +++ b/README.md @@ -187,12 +187,45 @@ pip3 install . pytest ``` Possible options for testing: -* For more verbosity, add "-v" or even "-vv" like this: pytest -vv -* To run just unit tests: pytest -munit -* To run just integration tests: pytest -mint -* To run a smoke test with only one device connected serially: pytest -msmoke1 - CAUTION: Running smoke1 will reset values on the device. - Be sure to hit the button on the device to reset after the test is run. -* To run a specific test: pytest -msmoke1 meshtastic/test/test_smoke1.py::test_smoke1_info -* To add another classification of tests, then look in pytest.ini -* To see the unit test code coverage: pytest --cov=meshtastic +* For more verbosity, add "-v" or even "-vv" like this: + +``` +pytest -vv +``` + +* To run just unit tests: + +``` +pytest +# or (more verbosely) +pytest -m unit +``` + +* To run just integration tests: + +``` +pytest -m int +``` + +* To run the smoke test with only one device connected serially: + +``` +pytest -m smoke1 +``` + +CAUTION: Running smoke1 will reset values on the device, including the region to 1 (US). +Be sure to hit the reset button on the device after the test is completed. + +* To run a specific test: + +``` +pytest -msmoke1 meshtastic/test/test_smoke1.py::test_smoke1_info +``` + +* To add another classification of tests such as "unit" or "smoke1", see [pytest.ini](pytest.ini). + +* To see the unit test code coverage: + +``` +pytest --cov=meshtastic +``` From bd037299b249f463bf7198e4b2c2091318818839 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Tue, 7 Dec 2021 08:45:33 -0800 Subject: [PATCH 2/2] remove extra print statements --- meshtastic/node.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/meshtastic/node.py b/meshtastic/node.py index 27261f4..ecd62aa 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -136,23 +136,18 @@ class Node: def deleteChannel(self, channelIndex): """Delete the specifed channelIndex and shift other channels up""" ch = self.channels[channelIndex] - print('ch:', ch, ' channelIndex:', channelIndex) if ch.role != channel_pb2.Channel.Role.SECONDARY: raise Exception("Only SECONDARY channels can be deleted") # we are careful here because if we move the "admin" channel the channelIndex we need to use # for sending admin channels will also change adminIndex = self.iface.localNode._getAdminChannelIndex() - print('adminIndex:', adminIndex) self.channels.pop(channelIndex) - print('channelIndex:', channelIndex) self._fixupChannels() # expand back to 8 channels index = channelIndex - print('max_channels:', self.iface.myInfo.max_channels) while index < self.iface.myInfo.max_channels: - print('index:', index) self.writeChannel(index, adminIndex=adminIndex) index += 1