Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 3638b2e

Browse files
chore: fix test asserts (#407)
Changing wrong asserts in tests to the correct function. This would break in python 3.12, but we don't build the CLI for 3.12 (yet)
1 parent 750e957 commit 3638b2e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/runners/test_pytest_standard_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_warning_bad_config(self, mock_warning):
5555
)
5656
runner = PytestStandardRunner(params)
5757
# Adding invalid config options emits a warning
58-
assert mock_warning.called_with(
58+
mock_warning.assert_called_with(
5959
"Config parameter 'some_missing_option' is unknonw."
6060
)
6161
# Warnings don't change the config

tests/services/static_analysis/test_analyse_file.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ def test_sample_analysis(input_filename, output_filename):
4747

4848
@patch("builtins.open")
4949
@patch("codecov_cli.services.staticanalysis.get_best_analyzer", return_value=None)
50-
def test_analyse_file_no_analyser(mock_get_analyser, mock_open):
51-
fake_contents = MagicMock()
50+
def test_analyse_file_no_analyzer(mock_get_analyzer, mock_open):
51+
fake_contents = MagicMock(name="fake_file_contents")
5252
file_name = MagicMock(actual_filepath="filepath")
53-
mock_open.return_value.read.return_value = fake_contents
53+
mock_open.return_value.__enter__.return_value.read.return_value = fake_contents
5454
config = {}
5555
res = analyze_file(config, file_name)
5656
assert res == None
57-
assert mock_open.called_with("filepath", "rb")
58-
assert mock_get_analyser.called_with(file_name, fake_contents)
57+
mock_open.assert_called_with("filepath", "rb")
58+
mock_get_analyzer.assert_called_with(file_name, fake_contents)

0 commit comments

Comments
 (0)