Skip to content

Commit f2ecc3e

Browse files
committed
fixed integration test on windows
1 parent a41f1c8 commit f2ecc3e

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

tests/test_cli.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121

2222
# Test ports for different test levels
23-
PORT_RO = os.environ.get("MPYTOOL_TEST_PORT")
24-
PORT_RW = os.environ.get("MPYTOOL_TEST_PORT_RW")
23+
# .strip() guards against trailing whitespace/CR from how the runner writes
24+
# the port into its config file (Windows `set /p` keeps trailing spaces).
25+
PORT_RO = (os.environ.get("MPYTOOL_TEST_PORT") or "").strip() or None
26+
PORT_RW = (os.environ.get("MPYTOOL_TEST_PORT_RW") or "").strip() or None
2527

2628
# RW implies RO
2729
if PORT_RW:
@@ -255,7 +257,10 @@ def test_ls_default(self):
255257

256258
def test_tree_root(self):
257259
"""tree :/ shows tree structure"""
258-
result = run_mpytool('-p', self.DEVICE_PORT, 'tree', ':/')
260+
# tree recurses the whole filesystem and returns it in one round-trip;
261+
# on a populated device over a slow serial link this needs more than
262+
# the default 10s.
263+
result = run_mpytool('-p', self.DEVICE_PORT, 'tree', ':/', timeout=30)
259264
self.assertEqual(result.returncode, 0)
260265

261266
def test_pwd(self):

tests/test_integration.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
_QUIET_LOG = _logger.SimpleColorLogger(loglevel=_logger.ERROR)
2121

2222
# Test ports for different test levels
23-
PORT_RO = os.environ.get("MPYTOOL_TEST_PORT")
24-
PORT_RW = os.environ.get("MPYTOOL_TEST_PORT_RW")
23+
# .strip() guards against trailing whitespace/CR from how the runner writes
24+
# the port into its config file (Windows `set /p` keeps trailing spaces).
25+
PORT_RO = (os.environ.get("MPYTOOL_TEST_PORT") or "").strip() or None
26+
PORT_RW = (os.environ.get("MPYTOOL_TEST_PORT_RW") or "").strip() or None
2527

2628
# RW implies RO
2729
if PORT_RW:

0 commit comments

Comments
 (0)