From a16150a847ee5368c97efa8b0cfd8316794fab41 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 29 May 2024 10:05:21 +0200 Subject: [PATCH] add `remote_update`pytest mark for future versions --- edge-node/src/procedures/configuration.py | 2 +- edge-node/tests/README.md | 5 +++-- edge-node/tests/communication_interfaces/test_logger.py | 4 +++- .../tests/communication_interfaces/test_messaging_loops.py | 3 +++ .../tests/communication_interfaces/test_mqtt_connection.py | 1 + .../tests/communication_interfaces/test_mqtt_receiving.py | 1 + .../tests/communication_interfaces/test_mqtt_sending.py | 2 ++ edge-node/tests/local_files/test_cli_startup.py | 1 + edge-node/tests/local_files/test_env_vars.py | 1 + edge-node/tests/local_files/test_local_libraries.py | 1 + edge-node/tests/local_files/test_new_config.py | 1 + 11 files changed, 18 insertions(+), 4 deletions(-) diff --git a/edge-node/src/procedures/configuration.py b/edge-node/src/procedures/configuration.py index 999d4864..6abef9e4 100644 --- a/edge-node/src/procedures/configuration.py +++ b/edge-node/src/procedures/configuration.py @@ -304,7 +304,7 @@ def _run_pytests( self.logger.debug(f"running all upgrading pytests") utils.run_shell_command( - f'.venv/bin/python -m pytest -m "version_update" tests/', + f'.venv/bin/python -m pytest -m "remote_update" tests/', working_directory=code_path(version), ) diff --git a/edge-node/tests/README.md b/edge-node/tests/README.md index ef19ebad..99907801 100644 --- a/edge-node/tests/README.md +++ b/edge-node/tests/README.md @@ -9,8 +9,9 @@ ## Additional Info - The Pytest mark `hardware_interface` can be skipped via the config parameter `run_hardware_tests` -- The Pytest mark `version_update` is run after every config update +- The Pytest mark `remote_update` is run after every config update - The Pytest mark `github_action` is run for commits within a pull request or the main branch +- The Pytest mark `version_update` is a legacy name and will be removed in future versions **Run tests/check static types:** @@ -22,7 +23,7 @@ pytest --cov=src --cov=cli tests/ pytest -m "github_action" --cov=src --cov=cli tests/ # only remote_update tests -pytest -m "version_update" --cov=src --cov=cli tests/ +pytest -m "remote_update" --cov=src --cov=cli tests/ # only hardware interface tests pytest -m "hardware_interface" --cov=src --cov=cli tests/ diff --git a/edge-node/tests/communication_interfaces/test_logger.py b/edge-node/tests/communication_interfaces/test_logger.py index 7dfa6117..8951087b 100644 --- a/edge-node/tests/communication_interfaces/test_logger.py +++ b/edge-node/tests/communication_interfaces/test_logger.py @@ -12,19 +12,21 @@ from src import utils, custom_types - +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_logger_without_sending(messaging_agent_without_sending: None) -> None: _test_logger(mqtt_communication_enabled=False) +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_logger_with_sending(messaging_agent_with_sending: None) -> None: _test_logger(mqtt_communication_enabled=True) +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_very_long_exception_cutting(messaging_agent_with_sending: None) -> None: diff --git a/edge-node/tests/communication_interfaces/test_messaging_loops.py b/edge-node/tests/communication_interfaces/test_messaging_loops.py index 957310c6..61d9cdc0 100644 --- a/edge-node/tests/communication_interfaces/test_messaging_loops.py +++ b/edge-node/tests/communication_interfaces/test_messaging_loops.py @@ -11,6 +11,7 @@ from src import custom_types, utils, procedures +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_messaging_loops_function( @@ -29,6 +30,7 @@ def test_messaging_loops_function( ) +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_messaging_loops_with_sending( @@ -49,6 +51,7 @@ def test_messaging_loops_with_sending( procedures.MQTTAgent.deinit() +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_messaging_loops_without_sending( diff --git a/edge-node/tests/communication_interfaces/test_mqtt_connection.py b/edge-node/tests/communication_interfaces/test_mqtt_connection.py index dbb1aeb3..e8924f60 100644 --- a/edge-node/tests/communication_interfaces/test_mqtt_connection.py +++ b/edge-node/tests/communication_interfaces/test_mqtt_connection.py @@ -10,6 +10,7 @@ from src import utils +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_mqtt_connection(mqtt_client_environment: None) -> None: diff --git a/edge-node/tests/communication_interfaces/test_mqtt_receiving.py b/edge-node/tests/communication_interfaces/test_mqtt_receiving.py index c34cc1a5..607cab09 100644 --- a/edge-node/tests/communication_interfaces/test_mqtt_receiving.py +++ b/edge-node/tests/communication_interfaces/test_mqtt_receiving.py @@ -19,6 +19,7 @@ # this test has to run last because it fucks up something to mqtt tests afterwards won't work ... +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action @pytest.mark.last diff --git a/edge-node/tests/communication_interfaces/test_mqtt_sending.py b/edge-node/tests/communication_interfaces/test_mqtt_sending.py index d9ad2cae..fdaf78a2 100644 --- a/edge-node/tests/communication_interfaces/test_mqtt_sending.py +++ b/edge-node/tests/communication_interfaces/test_mqtt_sending.py @@ -23,12 +23,14 @@ ) +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_message_sending_without_sending(messaging_agent_without_sending: None) -> None: _test_message_sending(mqtt_communication_enabled=False) +@pytest.mark.remote_update @pytest.mark.version_update @pytest.mark.github_action def test_message_sending_with_sending(messaging_agent_with_sending: None) -> None: diff --git a/edge-node/tests/local_files/test_cli_startup.py b/edge-node/tests/local_files/test_cli_startup.py index dcea8064..7101481e 100644 --- a/edge-node/tests/local_files/test_cli_startup.py +++ b/edge-node/tests/local_files/test_cli_startup.py @@ -9,6 +9,7 @@ CLI_PATH = os.path.join(PROJECT_DIR, "cli", "main.py") +@pytest.mark.remote_update @pytest.mark.version_update def test_cli_startup() -> None: """run the hermes-cli info command""" diff --git a/edge-node/tests/local_files/test_env_vars.py b/edge-node/tests/local_files/test_env_vars.py index d0abe401..38091906 100644 --- a/edge-node/tests/local_files/test_env_vars.py +++ b/edge-node/tests/local_files/test_env_vars.py @@ -7,6 +7,7 @@ PROJECT_DIR = dirname(dirname(dirname(os.path.abspath(__file__)))) +@pytest.mark.remote_update @pytest.mark.version_update def test_env_vars() -> None: """checks whether the local config/.env can be loaded""" diff --git a/edge-node/tests/local_files/test_local_libraries.py b/edge-node/tests/local_files/test_local_libraries.py index 0ec6da7e..e40d1649 100644 --- a/edge-node/tests/local_files/test_local_libraries.py +++ b/edge-node/tests/local_files/test_local_libraries.py @@ -1,6 +1,7 @@ import pytest +@pytest.mark.remote_update @pytest.mark.version_update def test_local_libraries() -> None: """checks whether the raspberry pi specific libraries can be loaded""" diff --git a/edge-node/tests/local_files/test_new_config.py b/edge-node/tests/local_files/test_new_config.py index eaba3e7f..f2843b35 100644 --- a/edge-node/tests/local_files/test_new_config.py +++ b/edge-node/tests/local_files/test_new_config.py @@ -8,6 +8,7 @@ CONFIG_PATH = os.path.join(PROJECT_DIR, "config", "config.json") +@pytest.mark.remote_update @pytest.mark.version_update def test_new_config() -> None: """checks whether the local config/config.json makes sense:"""