Skip to content

Commit

Permalink
Merge pull request #96 from rolandmas/pr-fix-testsuite
Browse files Browse the repository at this point in the history
Fix a few tests
  • Loading branch information
kif authored Sep 22, 2024
2 parents 16959db + 5d7f472 commit 830da6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/freesas/test/test_autorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ def test_synthetic(self):
)

def test_auto_gpa_with_outlier(self):
if "outlier_position" not in self.extra_arg:
raise unittest.SkipTest("No outlier position to test")

"""
Test that auto_gpa gives reasonalbe results
Expand Down Expand Up @@ -374,6 +376,9 @@ def test_curate_synthetic_data(self):
)

def test_curate_synthetic_data_with_negative_points(self):
if "negative_point_index" not in self.extra_arg:
raise unittest.SkipTest("No negative point index to test")

"""Test that if one of the first three points is negative, all date before it gets ignored."""
negative_point_index = self.extra_arg["negative_point_index"]

Expand Down
14 changes: 7 additions & 7 deletions src/freesas/test/test_sas_argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_minimal_guinier_parser_requires_file_argument(self):
output_catcher = io.StringIO()
try:
with contextlib.redirect_stderr(output_catcher):
_ = basic_parser.parse_args()
_ = basic_parser.parse_args([])
except SystemExit:
pass

Expand Down Expand Up @@ -172,8 +172,8 @@ def test_minimal_parser_default_verbosity_level_is_0(self):
"""
Test that the parser sets the verbosity to 0 if no args are provided
"""
basic_parser = SASParser("program", "description", "epilog")
parsed_arguments = basic_parser.parse_args()
basic_parser = SASParser("program", "description", "epilog", exit_on_error=False)
parsed_arguments = basic_parser.parse_args([])
self.assertEqual(
parsed_arguments.verbose,
0,
Expand Down Expand Up @@ -268,8 +268,8 @@ def test_minimal_guinier_parser_accepts_output_file_argument(self):
parsed_arguments = basic_parser.parse_args(["afile", "-o", "out.file"])

self.assertEqual(
parsed_arguments.output,
Path("out.file"),
str(parsed_arguments.output),
str(Path("out.file")),
msg="Minimal GuinierParser accepts output file argument",
)

Expand Down Expand Up @@ -297,8 +297,8 @@ def test_add_output_filename_argument_adds_output_file_argument_to_SASParser(
parsed_arguments = basic_parser.parse_args(["-o", "out.file"])

self.assertEqual(
parsed_arguments.output,
Path("out.file"),
str(parsed_arguments.output),
str(Path("out.file")),
msg="SASParser accepts output file argument"
"after running add_output_filename_argument()",
)
Expand Down

0 comments on commit 830da6e

Please sign in to comment.