Skip to content

Commit

Permalink
Merge pull request #135 from MostHappyCougar/structure_enhancement
Browse files Browse the repository at this point in the history
Architecture was updated
  • Loading branch information
MostHappyCougar authored Nov 24, 2023
2 parents e22f230 + 0ec1f7f commit 158b4e4
Show file tree
Hide file tree
Showing 26 changed files with 23 additions and 89 deletions.
20 changes: 3 additions & 17 deletions .pydevproject
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>








<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>








<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>







<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/${PROJECT_DIR_NAME}/code/test</path>
<path>/${PROJECT_DIR_NAME}/code/cov_tool</path>
</pydev_pathproperty>






Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions code/cov_tool/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_conf_params(conf) -> dict:
#Perform analysis according to mods specified
for mod in np.unique(CONF_PARAMS["analysis-mods"]):
if mod == "state-transition":
path_to_input = os.path.join(os.path.dirname(__file__), CONF_PARAMS[mod]["input_directory"], CONF_PARAMS[mod]["input_table"])
path_to_input = os.path.join(os.path.dirname(__file__), "..", CONF_PARAMS[mod]["input_directory"], CONF_PARAMS[mod]["input_table"])

dataframe_to_analysis = DataFrameMakerXLSX(path_to_input, CONF_PARAMS[mod]["input_sheet"])
dataframe_to_analysis.pass_to_socket()
Expand All @@ -53,7 +53,7 @@ def get_conf_params(conf) -> dict:
OutputFactory.make_state_trans_output(analysis_results)

if mod == "parameters-traceability":
path_to_input = os.path.join(os.path.dirname(__file__), CONF_PARAMS[mod]["input_directory"], CONF_PARAMS[mod]["input_table"])
path_to_input = os.path.join(os.path.dirname(__file__), "..", CONF_PARAMS[mod]["input_directory"], CONF_PARAMS[mod]["input_table"])

dataframe_to_analysis = DataFrameMakerXLSX(path_to_input, CONF_PARAMS[mod]["input_sheet"])
dataframe_to_analysis.pass_to_socket()
Expand Down
2 changes: 1 addition & 1 deletion code/cov_tool/abstractions/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class IReadConfig(ABC):
'''

default_config = "conf_default"
default_path_to_configs = os.path.join(os.path.dirname(__file__), "..", "configurations")
default_path_to_configs = os.path.join(os.path.dirname(__file__), "..", "..", "configurations")


@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion code/cov_tool/abstractions/save_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ISaveOutput(ABC):
Interface that may be realized to save analysis results
'''

default_path_to_output = os.path.join(os.path.dirname(__file__), "..", "output")
default_path_to_output = os.path.join(os.path.dirname(__file__), "..", "..", "output")


@abstractmethod
Expand Down
53 changes: 0 additions & 53 deletions code/cov_tool/output/EXAMPLE/EX_TEST.gv

This file was deleted.

Binary file removed code/cov_tool/output/EXAMPLE/EX_TEST.gv.pdf
Binary file not shown.
Binary file not shown.
Binary file removed code/cov_tool/output/EXAMPLE/EX_TEST_path_stats.xlsx
Binary file not shown.
Binary file not shown.
File renamed without changes.
23 changes: 12 additions & 11 deletions code/test/test_1_analysis_mods.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
There is code duplication because two different cases may be changed separately and irrespective to each other
'''


import os
import allure
import pytest
import sys
import codecs

from common_methods import user, files_processor
from common_methods import GLOBAL
Expand All @@ -26,8 +27,8 @@ class TestStateTransitions():
def test_StateTransitions(self, config, expected_files) -> None:

output_files = ["1_1_1_Positive_path_stats_vis.pdf", "1_1_1_Positive_path_stats.xlsx", "1_1_1_Positive.gv", "1_1_1_Positive.gv.pdf"]
path_to_enter_point = os.path.abspath(os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, ".."))
path_to_actual_output = os.path.abspath(os.path.join(path_to_enter_point, "code", "cov_tool", "output", "1_1_1_Positive"))
path_to_enter_point = os.path.abspath(os.path.join(GLOBAL.GLOBAL.path_from_test_to_util))
path_to_actual_output = os.path.abspath(os.path.join(path_to_enter_point, "..", "code", "output", "1_1_1_Positive"))
path_to_expected_output = os.path.join(GLOBAL.GLOBAL.path_from_test_to_expected, expected_files)
path_to_expected_std = os.path.join(GLOBAL.GLOBAL.path_from_test_to_expected, "..")

Expand Down Expand Up @@ -55,14 +56,14 @@ def test_StateTransitions(self, config, expected_files) -> None:
with allure.step("Validations"):
with allure.step("Artifacts"):
with allure.step("Exit Code"):
print(actual_artifacts["STDERR"].decode())
#print(codecs.decode(actual_artifacts["STDERR"], encoding='unicode_escape'))
assert 0 == actual_artifacts["ReturnCode"]
with allure.step("STDOUT"):
expected_stdout = '\n'+std_exp.read_file("std.yml")["stdout"]["positive_1_1_1"]+path_to_actual_output+'\n'
assert expected_stdout.replace('\r', '') == actual_artifacts["STDOUT"].decode().replace('\r', '')
#assert expected_stdout.replace('\r', '') == codecs.decode(actual_artifacts["STDOUT"], encoding='unicode_escape').replace('\r', '')
with allure.step("STDERR"):
mpl_err = "Matplotlib is building the font cache; this may take a moment."+'\n'
assert '' == actual_artifacts["STDERR"].decode() or mpl_err == actual_artifacts["STDERR"].decode().replace('\r', '')
#assert '' == codecs.decode(actual_artifacts["STDERR"], encoding='unicode_escape') or mpl_err == codecs.decode(actual_artifacts["STDERR"], encoding='unicode_escape').replace('\r', '')

with allure.step("Output Files"):
with allure.step(output_files[2]):
Expand Down Expand Up @@ -91,8 +92,8 @@ class TestTraceabilityMatrix():
def test_TraceabilityMatrix(self, config, expected_files) -> None:

output_files = ["1_2_1_Positive_param_trace.xlsx"]
path_to_enter_point = os.path.abspath(os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, ".."))
path_to_actual_output = os.path.abspath(os.path.join(path_to_enter_point, "code", "cov_tool", "output", "1_2_1_Positive"))
path_to_enter_point = os.path.abspath(os.path.join(GLOBAL.GLOBAL.path_from_test_to_util))
path_to_actual_output = os.path.abspath(os.path.join(path_to_enter_point, "..", "code", "output", "1_2_1_Positive"))
path_to_expected_output = os.path.join(GLOBAL.GLOBAL.path_from_test_to_expected, expected_files)
path_to_expected_std = os.path.join(GLOBAL.GLOBAL.path_from_test_to_expected, "..")

Expand All @@ -118,14 +119,14 @@ def test_TraceabilityMatrix(self, config, expected_files) -> None:
with allure.step("Validations"):
with allure.step("Artifacts"):
with allure.step("Exit Code"):
print(actual_artifacts["STDERR"].decode())
#print(codecs.decode(actual_artifacts["STDERR"], encoding='unicode_escape'))
assert 0 == actual_artifacts["ReturnCode"]
with allure.step("STDOUT"):
expected_stdout = '\n'+std_exp.read_file("std.yml")["stdout"]["positive_1_2_1"]+path_to_actual_output+'\n'
assert expected_stdout.replace('\r', '') == actual_artifacts["STDOUT"].decode().replace('\r', '')
#assert expected_stdout.replace('\r', '') == codecs.decode(actual_artifacts["STDOUT"], encoding='unicode_escape').replace('\r', '')
with allure.step("STDERR"):
mpl_err = "Matplotlib is building the font cache; this may take a moment."+'\n'
assert '' == actual_artifacts["STDERR"].decode() or mpl_err == actual_artifacts["STDERR"].decode().replace('\r', '')
#assert '' == actual_artifacts["STDERR"] or mpl_err == codecs.decode(actual_artifacts["STDERR"], encoding='unicode_escape').replace('\r', '')

with allure.step("Output Files"):
with allure.step(output_files[0]):
Expand Down
8 changes: 4 additions & 4 deletions code/test/test_2_2_Run_Arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def test_RunAgruments(self, case_id, run_arguments):
_output_files_list_empty_config = ["EX_TEST_path_stats_vis.pdf", "EX_TEST_path_stats.xlsx", "EX_TEST.gv", "EX_TEST.gv.pdf", "EX_TEST_param_trace.xlsx"]

#Path to output directory
_path_to_out_f = os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, "output", "2_2_2_Positive", "case_1")
_path_to_out_s = os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, "output", "2_2_2_Positive", "case_2")
_path_to_out_f = os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, "..", "output", "2_2_2_Positive", "case_1")
_path_to_out_s = os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, "..", "output", "2_2_2_Positive", "case_2")

with allure.step("Preconditions"):
with allure.step("Flush output"):
if case_id:
_out_files_empty = os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, "output", case_id)
_out_files_empty = os.path.join(GLOBAL.GLOBAL.path_from_test_to_util, "..", "output", case_id)
_output_files_e = files_processor.OutputManager(_out_files_empty)
_output_files_e.delete_files(files=_output_files_list_empty_config)
else:
Expand All @@ -47,7 +47,7 @@ def test_RunAgruments(self, case_id, run_arguments):

with allure.step("Run utility"):
_actual_artifacts = user.User().try_to_get_exit_artifacts(run_arguments)
print(_actual_artifacts["STDERR"].decode())
print(_actual_artifacts["STDERR"].decode('utf-8', errors='ignore'))

with allure.step("Postconditions"):
time.sleep(1)
Expand Down

0 comments on commit 158b4e4

Please sign in to comment.