Skip to content

Commit

Permalink
[TEST] adding unit_test marker
Browse files Browse the repository at this point in the history
  • Loading branch information
bclenet committed Mar 17, 2023
1 parent ccd3ad3 commit f8cc192
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ testpaths =
tests
markers =
pipeline_test: marks tests that execute complete pipelines
unit_test: marks unit tests
4 changes: 4 additions & 0 deletions tests/pipelines/test_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class TestPipelineDirectories:
""" A class that contains all the unit tests for the PipelineDirectories class."""

@staticmethod
@mark.unit_test
def test_create():
""" Test the creation of a PipelineDirectories object """

Expand All @@ -67,6 +68,7 @@ def test_create():
assert pipeline_dir.output_dir == 'test_o'

@staticmethod
@mark.unit_test
def test_alternative_setters():
""" Test the alternatives setters of PipelineDirectories """

Expand All @@ -92,6 +94,7 @@ class TestPipelines:
""" A class that contains all the unit tests for the Pipeline class."""

@staticmethod
@mark.unit_test
def test_create():
""" Test the creation of a Pipeline object """

Expand Down Expand Up @@ -125,6 +128,7 @@ class TestUtils:
""" A class that contains all the unit tests for the utils in module pipelines."""

@staticmethod
@mark.unit_test
def test_utils():
""" Test the utils methods of PipelineRunner """
# 1 - Get number of not implemented pipelines
Expand Down
1 change: 1 addition & 0 deletions tests/pipelines/test_team_2T6S.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class TestPipelinesTeam2T6S:
""" A class that contains all the unit tests for the PipelineTeam2T6S class."""

@staticmethod
@mark.unit_test
def test_create():
""" Test the creation of a PipelineTeam2T6S object """

Expand Down
4 changes: 4 additions & 0 deletions tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class TestPipelineRunner:
""" A class that contains all the unit tests for the PipelineRunner class."""

@staticmethod
@mark.unit_test
def test_create():
""" Test the creation of a PipelineRunner object """

Expand All @@ -120,6 +121,7 @@ def test_create():
runner.team_id = '08MQ'

@staticmethod
@mark.unit_test
def test_subjects():
""" Test the PipelineRunner features of building subject lists """
runner = PipelineRunner('2T6S')
Expand Down Expand Up @@ -154,6 +156,7 @@ def test_subjects():
assert runner.subjects == ['022', '043', '045']

@staticmethod
@mark.unit_test
def test_start_nok():
""" Test error cases for the start method of PipelineRunner """
# 1 - test starting a pipeline with no subject settings
Expand All @@ -180,6 +183,7 @@ def test_start_nok():
runner.start()

@staticmethod
@mark.unit_test
def test_start_ok():
""" Test normal usecases of PipelineRunner """
# 1 - test starting a pipeline where everything ok
Expand Down
4 changes: 4 additions & 0 deletions tests/utils/test_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class TestUtilsCorrelation:
""" A class that contains all the unit tests for the correlation module."""

@staticmethod
@mark.unit_test
def test_mask_nan():
""" Test the mask_using_nan function """
# 1 - Create an image
Expand All @@ -65,6 +66,7 @@ def test_mask_nan():
assert isnan(out_image_data[1, 1, 1])

@staticmethod
@mark.unit_test
def test_mask_zeros():
""" Test the mask_using_zeros function """
# 1 - Create an image
Expand All @@ -89,6 +91,7 @@ def test_mask_zeros():
assert isclose(out_image_data[1, 1, 1], 0.0)

@staticmethod
@mark.unit_test
def test_correlation(remove_temporary_files):
""" Test the get_correlation_coefficient function, normal usecases """
# 1 - Create an image & save it to the working directory
Expand Down Expand Up @@ -128,6 +131,7 @@ def test_correlation(remove_temporary_files):
0.08787495503274935)

@staticmethod
@mark.unit_test
def test_correlation_wrong(remove_temporary_files):
""" Test the get_correlation_coefficient function, error cases """
# 1 - Create an image & save it to the working directory
Expand Down
2 changes: 2 additions & 0 deletions tests/utils/test_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class TestUtilsDescription:
""" A class that contains all the unit tests for the description module."""

@staticmethod
@mark.unit_test
def test_creation():
""" Test the creation of a TeamDescription object """

Expand All @@ -34,6 +35,7 @@ def test_creation():
assert TeamDescription('2T6S') is not None

@staticmethod
@mark.unit_test
def test_arguments_properties():
""" Test the arguments and properties of a TeamDescription object """

Expand Down
2 changes: 2 additions & 0 deletions tests/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class TestUtils:
""" A class that contains all the unit tests for the utils module."""

@staticmethod
@mark.unit_test
def test_get_all_participants():
""" Test the get_all_participants function """
participants_list = get_all_participants()
Expand All @@ -26,6 +27,7 @@ def test_get_all_participants():
assert '123' in participants_list

@staticmethod
@mark.unit_test
def test_get_participants():
""" Test the get_participants function """

Expand Down

0 comments on commit f8cc192

Please sign in to comment.