diff --git a/testit-adapter-behave/setup.py b/testit-adapter-behave/setup.py index 6cf1e5e..34256e1 100644 --- a/testit-adapter-behave/setup.py +++ b/testit-adapter-behave/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = "4.2.6" +VERSION = "4.2.7" setup( name='testit-adapter-behave', diff --git a/testit-adapter-nose/setup.py b/testit-adapter-nose/setup.py index 63ecca8..e6b2b43 100644 --- a/testit-adapter-nose/setup.py +++ b/testit-adapter-nose/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = "4.2.6" +VERSION = "4.2.7" setup( name='testit-adapter-nose', diff --git a/testit-adapter-pytest/setup.py b/testit-adapter-pytest/setup.py index e0eaba6..0683903 100644 --- a/testit-adapter-pytest/setup.py +++ b/testit-adapter-pytest/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = "4.2.6" +VERSION = "4.2.7" setup( name='testit-adapter-pytest', diff --git a/testit-adapter-robotframework/setup.py b/testit-adapter-robotframework/setup.py index 9108783..7f239c2 100644 --- a/testit-adapter-robotframework/setup.py +++ b/testit-adapter-robotframework/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = "4.2.6" +VERSION = "4.2.7" setup( name='testit-adapter-robotframework', diff --git a/testit-python-commons/setup.py b/testit-python-commons/setup.py index 04d113b..7603c2a 100644 --- a/testit-python-commons/setup.py +++ b/testit-python-commons/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = "4.2.6" +VERSION = "4.2.7" setup( name='testit-python-commons', diff --git a/testit-python-commons/src/testit_python_commons/client/api_client.py b/testit-python-commons/src/testit_python_commons/client/api_client.py index 5bc95bd..6a7cb65 100644 --- a/testit-python-commons/src/testit_python_commons/client/api_client.py +++ b/testit-python-commons/src/testit_python_commons/client/api_client.py @@ -498,6 +498,9 @@ def update_test_results(self, fixtures_containers: dict, test_result_ids: dict) test_results = Converter.fixtures_containers_to_test_results_with_all_fixture_step_results( fixtures_containers, test_result_ids) + if not test_results: + return + for test_result in test_results: model = Converter.convert_test_result_with_all_setup_and_teardown_steps_to_test_results_id_put_request( test_result) diff --git a/testit-python-commons/src/testit_python_commons/client/converter.py b/testit-python-commons/src/testit_python_commons/client/converter.py index 09a7d34..ea2783a 100644 --- a/testit-python-commons/src/testit_python_commons/client/converter.py +++ b/testit-python-commons/src/testit_python_commons/client/converter.py @@ -515,7 +515,9 @@ def fixtures_containers_to_test_results_with_all_fixture_step_results( test_result_with_all_fixture_step_results.set_teardown_results( fixtures_container.afters[0].steps) - test_results_with_all_fixture_step_results.append(test_result_with_all_fixture_step_results) + if (test_result_with_all_fixture_step_results.get_setup_results() + or test_result_with_all_fixture_step_results.get_teardown_results()): + test_results_with_all_fixture_step_results.append(test_result_with_all_fixture_step_results) return test_results_with_all_fixture_step_results diff --git a/testit-python-commons/src/testit_python_commons/services/adapter_manager.py b/testit-python-commons/src/testit_python_commons/services/adapter_manager.py index b02931a..86d58ba 100644 --- a/testit-python-commons/src/testit_python_commons/services/adapter_manager.py +++ b/testit-python-commons/src/testit_python_commons/services/adapter_manager.py @@ -242,9 +242,11 @@ def write_tests(self) -> None: @adapter_logger def __load_setup_and_teardown_step_results(self) -> None: - self.__api_client.update_test_results( - self.__fixture_manager.get_all_items(), self.__test_result_map - ) + fixtures = self.__fixture_manager.get_all_items() + if not fixtures: + return + + self.__api_client.update_test_results(fixtures, self.__test_result_map) @adapter_logger def __write_tests_after_all(self) -> None: diff --git a/testit-python-commons/src/testit_python_commons/services/sync_storage/sync_storage_runner.py b/testit-python-commons/src/testit_python_commons/services/sync_storage/sync_storage_runner.py index 35fdf7f..b38eb54 100644 --- a/testit-python-commons/src/testit_python_commons/services/sync_storage/sync_storage_runner.py +++ b/testit-python-commons/src/testit_python_commons/services/sync_storage/sync_storage_runner.py @@ -40,7 +40,7 @@ class SyncStorageRunner: across multiple workers. """ - SYNC_STORAGE_VERSION = "v0.3.6-tms-5.7" + SYNC_STORAGE_VERSION = "v0.3.7-tms-5.7" SYNC_STORAGE_REPO_URL = ( "https://github.com/testit-tms/sync-storage-public/releases/download/" ) diff --git a/testit-python-commons/tests/client/test_converter_update_test_results.py b/testit-python-commons/tests/client/test_converter_update_test_results.py index 153d474..6e0470d 100644 --- a/testit-python-commons/tests/client/test_converter_update_test_results.py +++ b/testit-python-commons/tests/client/test_converter_update_test_results.py @@ -1,3 +1,5 @@ +from unittest.mock import Mock + from testit_python_commons.client.converter import Converter from testit_python_commons.models.outcome_type import OutcomeType from testit_python_commons.models.step_result import StepResult @@ -20,3 +22,15 @@ def test_setup_teardown_put_request_does_not_include_step_results(): assert len(model.setup_results) == 1 assert len(model.setup_results[0].step_results) == 1 assert model.setup_results[0].step_results[0].title == 'child' + + +def test_fixtures_converter_skips_tests_without_fixture_steps(): + fixtures_container = Mock() + fixtures_container.external_ids = ['other-test'] + + result = Converter.fixtures_containers_to_test_results_with_all_fixture_step_results( + {'uuid': fixtures_container}, + {'test-1': 'result-1'}, + ) + + assert result == [] diff --git a/testit-python-commons/tests/services/test_adapter_manager.py b/testit-python-commons/tests/services/test_adapter_manager.py index f5f9fa8..903e83b 100644 --- a/testit-python-commons/tests/services/test_adapter_manager.py +++ b/testit-python-commons/tests/services/test_adapter_manager.py @@ -88,6 +88,16 @@ def test_write_tests_realtime_import_enabled(self, adapter_manager, mock_adapter ) mock_api_client_worker.write_tests.assert_not_called() + def test_write_tests_realtime_skips_update_without_fixtures( + self, adapter_manager, mock_adapter_config, mock_api_client_worker, mock_fixture_manager): + mock_adapter_config.should_import_realtime.return_value = True + mock_fixture_manager.get_all_items.return_value = {} + + adapter_manager.write_tests() + + mock_fixture_manager.get_all_items.assert_called_once() + mock_api_client_worker.update_test_results.assert_not_called() + def test_load_attachments(self, adapter_manager, mock_api_client_worker): attach_paths = ["path/to/attachment1.txt", "path/to/attachment2.jpg"] expected_result = ["id1", "id2"] diff --git a/update_versions.sh b/update_versions.sh index 4fbcf66..d12284b 100644 --- a/update_versions.sh +++ b/update_versions.sh @@ -1,6 +1,6 @@ #!/bin/bash -NEW_VERSION="4.2.6" +NEW_VERSION="4.2.7" TESTIT_API_CLIENT_VERSION="7.5.10" echo "Updating all adapters to version: $NEW_VERSION"