Skip to content

Commit

Permalink
fix: removed try/except statements from tests
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Flottmann <[email protected]>
  • Loading branch information
art1f1c3R committed Nov 29, 2024
1 parent 0da8a8d commit 4f0ffde
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions tests/malware_analyzer/pypi/test_wheel_absence.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ def test_analyze_tar_present(pypi_package_json: MagicMock) -> None:
pypi_package_json.component.version = None
expected_result: tuple[HeuristicResult, dict] = (HeuristicResult.FAIL, {version: [filename]})

try:
actual_result = analyzer.analyze(pypi_package_json)
except HeuristicAnalyzerValueError:
pytest.fail("Analyzer threw a HeuristicAnalyzerValueError")
actual_result = analyzer.analyze(pypi_package_json)

assert actual_result == expected_result

Expand Down Expand Up @@ -104,10 +101,7 @@ def test_analyze_whl_present(pypi_package_json: MagicMock) -> None:
pypi_package_json.component.version = version
expected_result: tuple[HeuristicResult, dict] = (HeuristicResult.PASS, {version: [filename]})

try:
actual_result = analyzer.analyze(pypi_package_json)
except HeuristicAnalyzerValueError:
pytest.fail("Analyzer threw a HeuristicAnalyzerValueError")
actual_result = analyzer.analyze(pypi_package_json)

assert actual_result == expected_result

Expand Down Expand Up @@ -174,9 +168,6 @@ def test_analyze_both_present(pypi_package_json: MagicMock) -> None:
{version: [f"{file_prefix}.whl", f"{file_prefix}.tar.gz"]},
)

try:
actual_result = analyzer.analyze(pypi_package_json)
except HeuristicAnalyzerValueError:
pytest.fail("Analyzer threw a HeuristicAnalyzerValueError")
actual_result = analyzer.analyze(pypi_package_json)

assert actual_result == expected_result

0 comments on commit 4f0ffde

Please sign in to comment.