From 2fdfb2525889bf19f1f2d49c546f525855654fbc Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Mon, 2 Jul 2018 23:18:28 +0100 Subject: [PATCH] Fix mangled value for machine attribute in version function. --- CHANGES.rst | 5 +++++ microfs.py | 2 +- setup.py | 2 +- tests/test_microfs.py | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f926d85..90e82c9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ Release History =============== +1.3.1 +----- + +* Fix bug in version parsing that was mangling the ``machine`` attribute. + 1.3.0 ----- diff --git a/microfs.py b/microfs.py index c9ccfed..5c718af 100644 --- a/microfs.py +++ b/microfs.py @@ -294,7 +294,7 @@ def version(serial=None): # It doesn't matter what the error is, we just need to indicate a # failure with the expected ValueError exception. raise ValueError() - raw = out.decode('utf-8') + raw = out.decode('utf-8').strip() raw = raw[1:-1] items = raw.split(', ') result = {} diff --git a/setup.py b/setup.py index 1ae04b3..aa7b647 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ #: MAJOR, MINOR, RELEASE, STATUS [alpha, beta, final], VERSION -_VERSION = (1, 3, 0) +_VERSION = (1, 3, 1) def get_version(): diff --git a/tests/test_microfs.py b/tests/test_microfs.py index 6580703..690db84 100644 --- a/tests/test_microfs.py +++ b/tests/test_microfs.py @@ -539,7 +539,7 @@ def test_version_good_output(): b'release=\'1.0\', ' b'version="micro:bit v1.0-b\'e10a5ff\' on 2018-6-8; ' b'MicroPython v1.9.2-34-gd64154c73 on 2017-09-01", ' - b'machine=\'micro:bit with nRF51822\')') + b'machine=\'micro:bit with nRF51822\')\r\n') mock_serial = mock.MagicMock() with mock.patch('microfs.execute', return_value=(response, b'')) as execute: