Skip to content

Commit

Permalink
add remote_updatepytest mark for future versions
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjaigner committed May 29, 2024
1 parent 4826837 commit a16150a
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion edge-node/src/procedures/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)

Expand Down
5 changes: 3 additions & 2 deletions edge-node/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand All @@ -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/
Expand Down
4 changes: 3 additions & 1 deletion edge-node/tests/communication_interfaces/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions edge-node/tests/communication_interfaces/test_mqtt_sending.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions edge-node/tests/local_files/test_cli_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
1 change: 1 addition & 0 deletions edge-node/tests/local_files/test_env_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
1 change: 1 addition & 0 deletions edge-node/tests/local_files/test_local_libraries.py
Original file line number Diff line number Diff line change
@@ -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"""
Expand Down
1 change: 1 addition & 0 deletions edge-node/tests/local_files/test_new_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:"""
Expand Down

0 comments on commit a16150a

Please sign in to comment.