Skip to content

Commit fccce60

Browse files
committed
Added update-index test and semver testinf for versioning
1 parent a9fb4cd commit fccce60

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

test/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ filterwarnings =
44
ignore::DeprecationWarning
55
ignore::ResourceWarning
66

7-
addopts = -s --verbose --runslow
7+
addopts = -s --verbose

test/test_main.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import json
44
import pytest
5+
import semver
56

67
this_test_path = os.path.dirname(os.path.realpath(__file__))
78
# Calculate absolute path of the CLI
@@ -36,6 +37,9 @@ def test_command_lib_list():
3637
result = run_command('lib list', '--format json')
3738
assert '{}' == result.stdout
3839

40+
# def test_command_lib_download():
41+
# result = run_command('lib download')
42+
3943

4044
def test_command_lib_install():
4145
libs = ['\"AzureIoTProtocol_MQTT\"', '\"CMMC MQTT Connector\"', '\"WiFiNINA\"']
@@ -45,6 +49,9 @@ def test_command_lib_install():
4549
result_2 = run_command('lib install {}'.format(' '.join(libs)))
4650
assert result_2.ok
4751

52+
def test_command_lib_update_index():
53+
result = run_command('lib update-index')
54+
assert 'Updating index: library_index.json downloaded' == result.stdout.splitlines()[-1].strip()
4855

4956
def test_command_lib_remove():
5057
libs = ['\"AzureIoTProtocol_MQTT\"', '\"CMMC MQTT Connector\"', '\"WiFiNINA\"']
@@ -83,11 +90,13 @@ def test_command_board_listall():
8390
result = run_command('board listall')
8491
assert ['Board', 'Name', 'FQBN'] == result.stdout.splitlines()[0].strip().split()
8592

93+
8694
def test_command_version():
8795
result = run_command('version --format json')
8896
parsed_out = json.loads(result.stdout)
8997

9098
assert parsed_out.get('command', False) == 'arduino-cli'
91-
assert parsed_out.get('version', False)
92-
assert parsed_out.get('commit', False)
99+
assert isinstance(semver.parse(parsed_out.get('version', False)), dict)
100+
assert isinstance(parsed_out.get('commit', False), str)
93101
assert parsed_out.get('build_date', False)
102+

0 commit comments

Comments
 (0)