diff --git a/test_harness/protocol_verifier/__init__.py b/test_harness/protocol_verifier/__init__.py index a2c9215..ed44923 100644 --- a/test_harness/protocol_verifier/__init__.py +++ b/test_harness/protocol_verifier/__init__.py @@ -12,12 +12,12 @@ from test_harness.config.config import TestConfig, HarnessConfig from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig -from test_harness.protocol_verifier.generate_test_files import ( +from test_harness.protocol_verifier.testing_suite.generate_test_files import ( generate_test_events_from_puml_files, get_test_events_from_test_file_jsons, ) from test_harness.protocol_verifier.send_job_defs import send_job_defs_from_uml -from test_harness.protocol_verifier.test_utils import ( +from test_harness.protocol_verifier.testing_suite.base_test_classes import ( FunctionalTest, PerformanceTest, ) diff --git a/test_harness/protocol_verifier/metrics_and_events/__init__.py b/test_harness/protocol_verifier/metrics_and_events/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_harness/protocol_verifier/kafka_metrics.py b/test_harness/protocol_verifier/metrics_and_events/kafka_metrics.py similarity index 99% rename from test_harness/protocol_verifier/kafka_metrics.py rename to test_harness/protocol_verifier/metrics_and_events/kafka_metrics.py index ad867f2..973c8f1 100644 --- a/test_harness/protocol_verifier/kafka_metrics.py +++ b/test_harness/protocol_verifier/metrics_and_events/kafka_metrics.py @@ -11,7 +11,7 @@ import aiokafka from test_harness.simulator.simulator import ResultsHandler -from test_harness.protocol_verifier.types import ResultsDict +from test_harness.protocol_verifier.utils.types import ResultsDict from test_harness.metrics.metrics import MetricsRetriever diff --git a/test_harness/protocol_verifier/send_events.py b/test_harness/protocol_verifier/metrics_and_events/send_events.py similarity index 99% rename from test_harness/protocol_verifier/send_events.py rename to test_harness/protocol_verifier/metrics_and_events/send_events.py index 4ee3f9c..b6ca0cd 100644 --- a/test_harness/protocol_verifier/send_events.py +++ b/test_harness/protocol_verifier/metrics_and_events/send_events.py @@ -25,7 +25,7 @@ MessageExceptionHandler, MessageSender, ) -from test_harness.protocol_verifier.types import ERROR_LOG_FILE_PREFIX +from test_harness.protocol_verifier.utils.types import ERROR_LOG_FILE_PREFIX class ErrorLogger: diff --git a/test_harness/protocol_verifier/mocks/mock_pv_http_interface.py b/test_harness/protocol_verifier/mocks/mock_pv_http_interface.py index a19d2ed..b6dd2a1 100644 --- a/test_harness/protocol_verifier/mocks/mock_pv_http_interface.py +++ b/test_harness/protocol_verifier/mocks/mock_pv_http_interface.py @@ -7,7 +7,7 @@ from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig from aioresponses import aioresponses, CallbackResult -from test_harness.protocol_verifier.utils import PVLogFileNameCallback +from test_harness.protocol_verifier.utils.utils import PVLogFileNameCallback @contextmanager diff --git a/test_harness/protocol_verifier/calc_pv_finish.py b/test_harness/protocol_verifier/pv_file_inspector.py similarity index 100% rename from test_harness/protocol_verifier/calc_pv_finish.py rename to test_harness/protocol_verifier/pv_file_inspector.py diff --git a/test_harness/protocol_verifier/results/__init__.py b/test_harness/protocol_verifier/results/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_harness/protocol_verifier/pvfunctionalresults.py b/test_harness/protocol_verifier/results/pv_functional_results.py similarity index 99% rename from test_harness/protocol_verifier/pvfunctionalresults.py rename to test_harness/protocol_verifier/results/pv_functional_results.py index 90a86b5..b3a337b 100644 --- a/test_harness/protocol_verifier/pvfunctionalresults.py +++ b/test_harness/protocol_verifier/results/pv_functional_results.py @@ -7,7 +7,7 @@ # pylint: disable=C0114 import pandas as pd -from .pvresults import PVResults +from .pv_results import PVResults class PVFunctionalResults(PVResults): diff --git a/test_harness/protocol_verifier/pvperformanceresults.py b/test_harness/protocol_verifier/results/pv_performance_results.py similarity index 99% rename from test_harness/protocol_verifier/pvperformanceresults.py rename to test_harness/protocol_verifier/results/pv_performance_results.py index 310cd9e..ff42294 100644 --- a/test_harness/protocol_verifier/pvperformanceresults.py +++ b/test_harness/protocol_verifier/results/pv_performance_results.py @@ -28,12 +28,12 @@ AggregationTask, BinValueCount, ) -from .pvresults import PVResults -from .pvresultsdataframecalculator import ( +from .pv_results import PVResults +from .pv_results_dataframe_calculator import ( PVResultsDataFrameCalculatorV2, PVResultsDataFrameCalculator, ) -from .types import ( +from test_harness.protocol_verifier.utils.types import ( AveragesDict, FailuresDict, ProcessErrorDataDict, @@ -41,7 +41,9 @@ ResultsDict, ) from test_harness.results.results import ResultsHolder, DictResultsHolder -from .kafka_metrics import consume_events_from_kafka_topic +from test_harness.protocol_verifier.metrics_and_events.kafka_metrics import ( + consume_events_from_kafka_topic +) class PVPerformanceResults(PVResults): diff --git a/test_harness/protocol_verifier/pvresults.py b/test_harness/protocol_verifier/results/pv_results.py similarity index 100% rename from test_harness/protocol_verifier/pvresults.py rename to test_harness/protocol_verifier/results/pv_results.py diff --git a/test_harness/protocol_verifier/pvresultsdataframe.py b/test_harness/protocol_verifier/results/pv_results_dataframe.py similarity index 96% rename from test_harness/protocol_verifier/pvresultsdataframe.py rename to test_harness/protocol_verifier/results/pv_results_dataframe.py index c12c1e2..c38cb0e 100644 --- a/test_harness/protocol_verifier/pvresultsdataframe.py +++ b/test_harness/protocol_verifier/results/pv_results_dataframe.py @@ -9,7 +9,7 @@ # pylint: disable=R0914 import warnings -from .pvperformanceresults import ( +from .pv_performance_results import ( PVPerformanceResults, ) diff --git a/test_harness/protocol_verifier/pvresultsdataframecalculator.py b/test_harness/protocol_verifier/results/pv_results_dataframe_calculator.py similarity index 99% rename from test_harness/protocol_verifier/pvresultsdataframecalculator.py rename to test_harness/protocol_verifier/results/pv_results_dataframe_calculator.py index 15cc265..eeae498 100644 --- a/test_harness/protocol_verifier/pvresultsdataframecalculator.py +++ b/test_harness/protocol_verifier/results/pv_results_dataframe_calculator.py @@ -14,13 +14,15 @@ import scipy.stats as sps import dask.array as da -from .types import ( +from test_harness.protocol_verifier.utils.types import ( AveragesDict, FailuresDict, ReceptionCountsDict, ) from test_harness.results.results import ResultsHolder -from test_harness.protocol_verifier.pvperformanceresults import AggregationTask +from test_harness.protocol_verifier.results.pv_performance_results import ( + AggregationTask +) class PVResultsDataFrameCalculator: diff --git a/test_harness/protocol_verifier/pvresultshandler.py b/test_harness/protocol_verifier/results/pv_results_handler.py similarity index 97% rename from test_harness/protocol_verifier/pvresultshandler.py rename to test_harness/protocol_verifier/results/pv_results_handler.py index ea35ce5..714025b 100644 --- a/test_harness/protocol_verifier/pvresultshandler.py +++ b/test_harness/protocol_verifier/results/pv_results_handler.py @@ -18,13 +18,13 @@ import aiokafka from test_harness.simulator.simulator import QueueHandler, ResultsHandler -from .pvresults import PVResults -from .pvperformanceresults import PVPerformanceResults -from .kafka_metrics import ( +from .pv_results import PVResults +from .pv_performance_results import PVPerformanceResults +from test_harness.protocol_verifier.metrics_and_events.kafka_metrics import ( decode_and_yield_events_from_raw_msgs, decode_and_yield_events_from_raw_msgs_no_length, ) -from .types import PVResultsHandlerItem +from test_harness.protocol_verifier.utils.types import PVResultsHandlerItem class PVResultsAdder(ResultsHandler): diff --git a/test_harness/protocol_verifier/simulator_data.py b/test_harness/protocol_verifier/simulator_data.py index 02c1c31..a30b389 100644 --- a/test_harness/protocol_verifier/simulator_data.py +++ b/test_harness/protocol_verifier/simulator_data.py @@ -16,7 +16,7 @@ from abc import ABC, abstractmethod from test_harness.simulator.simulator import SimDatum, Batch, async_do_nothing -from test_harness.protocol_verifier.types import TemplateOptions +from test_harness.protocol_verifier.utils.types import TemplateOptions class PVSimDatumTransformer(ABC): diff --git a/test_harness/protocol_verifier/testing_suite/__init__.py b/test_harness/protocol_verifier/testing_suite/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_harness/protocol_verifier/test_utils.py b/test_harness/protocol_verifier/testing_suite/base_test_classes.py similarity index 98% rename from test_harness/protocol_verifier/test_utils.py rename to test_harness/protocol_verifier/testing_suite/base_test_classes.py index 7d40623..7f4833b 100644 --- a/test_harness/protocol_verifier/test_utils.py +++ b/test_harness/protocol_verifier/testing_suite/base_test_classes.py @@ -35,7 +35,7 @@ RollOverChoice, choose_from_front_of_list, ) -from test_harness.protocol_verifier.calc_pv_finish import ( +from test_harness.protocol_verifier.pv_file_inspector import ( PVFileInspector, handle_domain_log_file_reception_and_save, ) @@ -67,25 +67,31 @@ AsyncKillManager, AsyncKillException, ) -from .pvresults import PVResults -from .pvresultshandler import ( +from test_harness.protocol_verifier.results.pv_results import PVResults +from test_harness.protocol_verifier.results.pv_results_handler import ( PVResultsHandler, PVResultsAdder, PVKafkaMetricsHandler, PVKafkaMetricsHandlerNoLength, ) -from .pvperformanceresults import PVPerformanceResults -from .kafka_metrics import PVKafkaMetricsRetriever -from .pvresultsdataframe import PVResultsDataFrame -from .pvfunctionalresults import PVFunctionalResults -from .types import ( +from test_harness.protocol_verifier.results.pv_performance_results import ( + PVPerformanceResults +) +from ..metrics_and_events.kafka_metrics import PVKafkaMetricsRetriever +from test_harness.protocol_verifier.results.pv_results_dataframe import ( + PVResultsDataFrame +) +from test_harness.protocol_verifier.results.pv_functional_results import ( + PVFunctionalResults +) +from ..utils.types import ( TemplateOptions, MetricsRetriverKwargsPairAndHandlerKwargsPair, MetricsRetrieverKwargsPair, ResultsHandlerKwargsPair, ERROR_LOG_FILE_PREFIX, ) -from .send_events import ( +from ..metrics_and_events.send_events import ( get_message_bus_kwargs, get_producer_kwargs, PVMessageSender, diff --git a/test_harness/protocol_verifier/create_test_file_json.py b/test_harness/protocol_verifier/testing_suite/create_test_file_json.py similarity index 100% rename from test_harness/protocol_verifier/create_test_file_json.py rename to test_harness/protocol_verifier/testing_suite/create_test_file_json.py diff --git a/test_harness/protocol_verifier/generate_test_files.py b/test_harness/protocol_verifier/testing_suite/generate_test_files.py similarity index 99% rename from test_harness/protocol_verifier/generate_test_files.py rename to test_harness/protocol_verifier/testing_suite/generate_test_files.py index a595c5e..5dd3469 100644 --- a/test_harness/protocol_verifier/generate_test_files.py +++ b/test_harness/protocol_verifier/testing_suite/generate_test_files.py @@ -4,7 +4,7 @@ import json from test_harness.config.config import TestConfig -from test_harness.protocol_verifier.types import ( +from test_harness.protocol_verifier.utils.types import ( TestJobFile, TemplateJobsDataAndValidityTuple, SequenceTypeData, UpdateableIterator ) diff --git a/test_harness/protocol_verifier/tests/conftest.py b/test_harness/protocol_verifier/tests/conftest.py index 0612288..b07014b 100644 --- a/test_harness/protocol_verifier/tests/conftest.py +++ b/test_harness/protocol_verifier/tests/conftest.py @@ -12,7 +12,7 @@ from pygrok import Grok from typing import Generator, Literal, Callable, Any from test_harness.simulator.simulator import SimDatum -from test_harness.protocol_verifier.test_utils import ( +from test_harness.protocol_verifier.testing_suite.base_test_classes import ( PVPerformanceResults, PVResultsDataFrame, ) diff --git a/test_harness/protocol_verifier/tests/test_kafka_metrics.py b/test_harness/protocol_verifier/tests/metrics_and_events/test_kafka_metrics.py similarity index 96% rename from test_harness/protocol_verifier/tests/test_kafka_metrics.py rename to test_harness/protocol_verifier/tests/metrics_and_events/test_kafka_metrics.py index 08ceb96..3d0b484 100644 --- a/test_harness/protocol_verifier/tests/test_kafka_metrics.py +++ b/test_harness/protocol_verifier/tests/metrics_and_events/test_kafka_metrics.py @@ -3,7 +3,7 @@ import aiokafka -from test_harness.protocol_verifier.kafka_metrics import ( +from test_harness.protocol_verifier.metrics_and_events.kafka_metrics import ( decode_and_yield_events_from_raw_msgs_no_length, ) diff --git a/test_harness/protocol_verifier/tests/test_send_events.py b/test_harness/protocol_verifier/tests/metrics_and_events/test_send_events.py similarity index 99% rename from test_harness/protocol_verifier/tests/test_send_events.py rename to test_harness/protocol_verifier/tests/metrics_and_events/test_send_events.py index 8a7c30b..6406ad0 100644 --- a/test_harness/protocol_verifier/tests/test_send_events.py +++ b/test_harness/protocol_verifier/tests/metrics_and_events/test_send_events.py @@ -17,7 +17,7 @@ from test_harness.utils import check_dict_equivalency from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig from test_harness.message_buses.message_buses import get_producer_context -from test_harness.protocol_verifier.send_events import ( +from test_harness.protocol_verifier.metrics_and_events.send_events import ( PVInputConverter, PVResponseConverter, PVMessageResponseConverter, diff --git a/test_harness/protocol_verifier/tests/test_calc_pv_finish.py b/test_harness/protocol_verifier/tests/test_calc_pv_finish.py index fbbc0f8..14682c7 100644 --- a/test_harness/protocol_verifier/tests/test_calc_pv_finish.py +++ b/test_harness/protocol_verifier/tests/test_calc_pv_finish.py @@ -7,7 +7,7 @@ from aioresponses import aioresponses -from test_harness.protocol_verifier.calc_pv_finish import pv_inspector_io +from test_harness.protocol_verifier.pv_file_inspector import pv_inspector_io logging.basicConfig(level=logging.INFO) diff --git a/test_harness/protocol_verifier/tests/test_protocol_verifier__init__.py b/test_harness/protocol_verifier/tests/test_protocol_verifier__init__.py index 69ec921..b768597 100644 --- a/test_harness/protocol_verifier/tests/test_protocol_verifier__init__.py +++ b/test_harness/protocol_verifier/tests/test_protocol_verifier__init__.py @@ -29,7 +29,9 @@ select_store_paths, full_pv_test, ) -from test_harness.protocol_verifier.generate_test_files import TestJobFile +from test_harness.protocol_verifier.testing_suite.generate_test_files import ( + TestJobFile +) from test_harness.utils import clean_directories from test_harness.simulator.simulator_profile import Profile from test_harness import AsyncTestStopper diff --git a/test_harness/protocol_verifier/tests/test_simulator_data.py b/test_harness/protocol_verifier/tests/test_simulator_data.py index bcd9654..327972d 100644 --- a/test_harness/protocol_verifier/tests/test_simulator_data.py +++ b/test_harness/protocol_verifier/tests/test_simulator_data.py @@ -30,7 +30,7 @@ convert_list_dict_to_json_io_bytes, convert_list_dict_to_pv_json_io_bytes, ) -from test_harness.protocol_verifier.types import TemplateOptions +from test_harness.protocol_verifier.utils.types import TemplateOptions uuid4hex = re.compile("[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}\\Z", re.I) diff --git a/test_harness/protocol_verifier/tests/test_tests.py b/test_harness/protocol_verifier/tests/testing_suite/test_base_test_classes.py similarity index 99% rename from test_harness/protocol_verifier/tests/test_tests.py rename to test_harness/protocol_verifier/tests/testing_suite/test_base_test_classes.py index 21ac27c..c41cb3c 100644 --- a/test_harness/protocol_verifier/tests/test_tests.py +++ b/test_harness/protocol_verifier/tests/testing_suite/test_base_test_classes.py @@ -33,24 +33,24 @@ from test_harness.config.config import TestConfig from test_harness.protocol_verifier.config.config import ProtocolVerifierConfig -from test_harness.protocol_verifier.generate_test_files import ( +from test_harness.protocol_verifier.testing_suite.generate_test_files import ( generate_test_events_from_puml_files, ) -from test_harness.protocol_verifier.pvperformanceresults import ( +from test_harness.protocol_verifier.results.pv_performance_results import ( ProcessErrorDataDict, ResultsDict, ) -from test_harness.protocol_verifier.pvresultsdataframe import ( +from test_harness.protocol_verifier.results.pv_results_dataframe import ( PVResultsDataFrame, ) -from test_harness.protocol_verifier.test_utils import ( +from test_harness.protocol_verifier.testing_suite.base_test_classes import ( FunctionalTest, PerformanceTest, PVFunctionalResults, PVResultsHandler, ) from test_harness import TestHarnessPbar -from test_harness.protocol_verifier.types import PVResultsHandlerItem +from test_harness.protocol_verifier.utils.types import PVResultsHandlerItem from test_harness.simulator.simulator_profile import Profile from test_harness.utils import ( check_dict_equivalency, @@ -62,25 +62,25 @@ ) from test_harness.results.results import DictResultsHolder, ResultsHolder from test_harness import AsyncTestStopper -from test_harness.protocol_verifier.types import ERROR_LOG_FILE_PREFIX +from test_harness.protocol_verifier.utils.types import ERROR_LOG_FILE_PREFIX # get test config test_config_path = os.path.join( - Path(__file__).parent.parent.parent.parent + Path(__file__).parent.parent.parent.parent.parent / "tests/test_harness/config/test_config.config", ) # test files directory path -test_files_path = Path(__file__).parent / "test_files" +test_files_path = Path(__file__).parent.parent / "test_files" # get path of tests uml file test_file_path = os.path.join( - Path(__file__).parent / "test_files", "test_uml_job_def.puml" + Path(__file__).parent.parent / "test_files", "test_uml_job_def.puml" ) # grok file path -grok_file = Path(__file__).parent / "test_files" / "grok_file.txt" +grok_file = Path(__file__).parent.parent / "test_files" / "grok_file.txt" def check_numpy_expected_vs_actual( diff --git a/test_harness/protocol_verifier/tests/test_generate_test_files.py b/test_harness/protocol_verifier/tests/testing_suite/test_generate_test_files.py similarity index 98% rename from test_harness/protocol_verifier/tests/test_generate_test_files.py rename to test_harness/protocol_verifier/tests/testing_suite/test_generate_test_files.py index 5c3e331..d3fc060 100644 --- a/test_harness/protocol_verifier/tests/test_generate_test_files.py +++ b/test_harness/protocol_verifier/tests/testing_suite/test_generate_test_files.py @@ -5,7 +5,7 @@ import pytest -from test_harness.protocol_verifier.generate_test_files import ( +from test_harness.protocol_verifier.testing_suite.generate_test_files import ( generate_test_events_from_puml_file, generate_test_events_from_puml_files, load_test_file_data_json_into_test_file_holder, @@ -16,7 +16,7 @@ from test_harness.utils import check_dict_equivalency # test file resources folder -test_file_resources = Path(__file__).parent / "test_files" +test_file_resources = Path(__file__).parent.parent / "test_files" def test_generate_test_events_from_puml_file_default_config() -> None: diff --git a/test_harness/protocol_verifier/types.py b/test_harness/protocol_verifier/utils/types.py similarity index 100% rename from test_harness/protocol_verifier/types.py rename to test_harness/protocol_verifier/utils/types.py diff --git a/test_harness/protocol_verifier/utils.py b/test_harness/protocol_verifier/utils/utils.py similarity index 100% rename from test_harness/protocol_verifier/utils.py rename to test_harness/protocol_verifier/utils/utils.py