move slower unit tests to unitslow

This commit is contained in:
Mike Kinney
2022-01-05 21:12:50 -08:00
parent 6c7a870645
commit cba424fde0
5 changed files with 19 additions and 19 deletions

View File

@@ -16,7 +16,7 @@ lint:
# show the slowest unit tests
slow:
pytest --durations=5
pytest -m unit --durations=5
# run the coverage report and open results in a browser
cov:

View File

@@ -591,7 +591,7 @@ def test_showNodes_exclude_self(capsys, caplog, reset_globals, iface_with_nodes)
capsys.readouterr()
@pytest.mark.unit
@pytest.mark.unitslow
def test_waitForConfig(caplog, capsys):
"""Test waitForConfig()"""
iface = MeshInterface(noProto=True)

View File

@@ -882,7 +882,7 @@ def test_onResponseRequestSetting_with_error(capsys):
assert err == ''
@pytest.mark.unit
@pytest.mark.unitslow
def test_waitForConfig():
"""Test waitForConfig()"""
anode = Node('foo', 'bar')

View File

@@ -99,7 +99,7 @@ def test_onTunnelReceive_from_someone_else(mock_platform_system, caplog, reset_g
assert re.search(r'in onTunnelReceive', caplog.text, re.MULTILINE)
@pytest.mark.unit
@pytest.mark.unitslow
@patch('platform.system')
def test_shouldFilterPacket_random(mock_platform_system, caplog, reset_globals, iface_with_nodes):
"""Test _shouldFilterPacket()"""
@@ -117,7 +117,7 @@ def test_shouldFilterPacket_random(mock_platform_system, caplog, reset_globals,
assert not ignore
@pytest.mark.unit
@pytest.mark.unitslow
@patch('platform.system')
def test_shouldFilterPacket_in_blacklist(mock_platform_system, caplog, reset_globals, iface_with_nodes):
"""Test _shouldFilterPacket()"""
@@ -135,7 +135,7 @@ def test_shouldFilterPacket_in_blacklist(mock_platform_system, caplog, reset_glo
assert ignore
@pytest.mark.unit
@pytest.mark.unitslow
@patch('platform.system')
def test_shouldFilterPacket_icmp(mock_platform_system, caplog, reset_globals, iface_with_nodes):
"""Test _shouldFilterPacket()"""
@@ -173,7 +173,7 @@ def test_shouldFilterPacket_udp(mock_platform_system, caplog, reset_globals, ifa
assert not ignore
@pytest.mark.unit
@pytest.mark.unitslow
@patch('platform.system')
def test_shouldFilterPacket_udp_blacklisted(mock_platform_system, caplog, reset_globals, iface_with_nodes):
"""Test _shouldFilterPacket()"""
@@ -213,7 +213,7 @@ def test_shouldFilterPacket_tcp(mock_platform_system, caplog, reset_globals, ifa
assert not ignore
@pytest.mark.unit
@pytest.mark.unitslow
@patch('platform.system')
def test_shouldFilterPacket_tcp_blacklisted(mock_platform_system, caplog, reset_globals, iface_with_nodes):
"""Test _shouldFilterPacket()"""
@@ -234,7 +234,7 @@ def test_shouldFilterPacket_tcp_blacklisted(mock_platform_system, caplog, reset_
assert ignore
@pytest.mark.unit
@pytest.mark.unitslow
@patch('platform.system')
def test_ipToNodeId_none(mock_platform_system, caplog, reset_globals, iface_with_nodes):
"""Test _ipToNodeId()"""
@@ -250,7 +250,7 @@ def test_ipToNodeId_none(mock_platform_system, caplog, reset_globals, iface_with
assert nodeid is None
@pytest.mark.unit
@pytest.mark.unitslow
@patch('platform.system')
def test_ipToNodeId_all(mock_platform_system, caplog, reset_globals, iface_with_nodes):
"""Test _ipToNodeId()"""

View File

@@ -88,7 +88,7 @@ def test_pskToString_one_byte_zero_value():
assert pskToString(bytes([0x00])) == 'unencrypted'
@pytest.mark.unit
@pytest.mark.unitslow
def test_pskToString_one_byte_non_zero_value():
"""Test pskToString one byte that is non-zero"""
assert pskToString(bytes([0x01])) == 'default'
@@ -118,7 +118,7 @@ def test_our_exit_zero_return_value(capsys):
assert pytest_wrapped_e.value.code == 0
@pytest.mark.unit
@pytest.mark.unitslow
def test_our_exit_non_zero_return_value(capsys):
"""Test our_exit with a non-zero return value"""
with pytest.raises(SystemExit) as pytest_wrapped_e:
@@ -130,7 +130,7 @@ def test_our_exit_non_zero_return_value(capsys):
assert pytest_wrapped_e.value.code == 1
@pytest.mark.unit
@pytest.mark.unitslow
def test_fixme():
"""Test fixme()"""
with pytest.raises(Exception) as pytest_wrapped_e:
@@ -166,7 +166,7 @@ def test_remove_keys_from_dict_empty_keys_empty_dict():
assert not remove_keys_from_dict((), {})
@pytest.mark.unit
@pytest.mark.unitslow
def test_remove_keys_from_dict_empty_dict():
"""Test when dict is empty"""
assert not remove_keys_from_dict(('a'), {})
@@ -178,13 +178,13 @@ def test_remove_keys_from_dict_empty_keys():
assert remove_keys_from_dict((), {'a':1}) == {'a':1}
@pytest.mark.unit
@pytest.mark.unitslow
def test_remove_keys_from_dict():
"""Test remove_keys_from_dict()"""
assert remove_keys_from_dict(('b'), {'a':1, 'b':2}) == {'a':1}
@pytest.mark.unit
@pytest.mark.unitslow
def test_remove_keys_from_dict_multiple_keys():
"""Test remove_keys_from_dict()"""
keys = ('a', 'b')
@@ -224,7 +224,7 @@ def test_hexstr():
assert hexstr(b'') == ''
@pytest.mark.unit
@pytest.mark.unitslow
def test_ipstr():
"""Test ipstr()"""
assert ipstr(b'1234') == '49.50.51.52'
@@ -237,14 +237,14 @@ def test_readnet_u16():
assert readnet_u16(b'123456', 2) == 13108
@pytest.mark.unit
@pytest.mark.unitslow
@patch('serial.tools.list_ports.comports', return_value=[])
def test_findPorts_when_none_found(patch_comports):
"""Test findPorts()"""
assert not findPorts()
@pytest.mark.unit
@pytest.mark.unitslow
def test_convert_mac_addr():
"""Test convert_mac_addr()"""
assert convert_mac_addr('/c0gFyhb') == 'fd:cd:20:17:28:5b'