File tree Expand file tree Collapse file tree 3 files changed +12
-19
lines changed
Expand file tree Collapse file tree 3 files changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010### Changed
1111
1212- dropped 'verbose' argument from list_boards()
13+ - dropped 'full' argument from version()
1314
1415## [ 0.1.1] - 2024-07-11
1516
Original file line number Diff line number Diff line change 55import pytest
66
77import tycmd
8- import re
98
109
1110BLINK_HEX = Path (__file__ ).parent .joinpath ("blink.hex" ).resolve ()
@@ -48,12 +47,7 @@ def test_list_boards(mock_check_output):
4847
4948
5049def test_version ():
51- output = tycmd .version (full = True )
52- assert isinstance (output , str )
53- match = re .search (r"^.+(\d+\.\d+\.\d+)" , output )
54- assert match is not None
55- assert match .groups ()[0 ] == tycmd ._TYCMD_VERSION
56- assert tycmd .version (full = False ) == tycmd ._TYCMD_VERSION
50+ assert tycmd .version () == tycmd ._TYCMD_VERSION
5751
5852
5953def test__parse_firmware_file ():
Original file line number Diff line number Diff line change @@ -49,27 +49,25 @@ def list_boards() -> list[dict]:
4949 return json .loads (return_string )
5050
5151
52- def version (full : bool = False ) -> str :
52+ def version () -> str :
5353 """
54- Return version information from tycmd.
55-
56- Parameters
57- ----------
58- full : bool, optional
59- If True, return the full version string as returned by the tycmd binary. If
60- False, return only the version number. Default is False.
54+ Return version information from tycmd binary.
6155
6256 Returns
6357 -------
6458 str
6559 The version of tycmd.
60+
61+ Raises
62+ ------
63+ RuntimeError
64+ If the version string could not be determined.
6665 """
6766 output = _call_tycmd (["--version" ])
68- if full :
69- return output .strip ()
67+ match = re .search (r"\d+\.\d+\.\d+" , output )
68+ if match is None :
69+ raise RuntimeError ("Could not determine tycmd version" )
7070 else :
71- if (match := re .search (r"\d+\.\d+\.\d+" , output )) is None :
72- return ""
7371 return match .group ()
7472
7573
You can’t perform that action at this time.
0 commit comments