Skip to content

Commit

Permalink
Fix empty lines between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blablatdinov committed Jun 11, 2024
1 parent 638c364 commit fbff8e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ def run_mutation_stub(*_):
with patch('mutmut.run_mutation', run_mutation_stub):
check_mutants_original(**kwargs)


class ConfigStub:
hash_of_tests = None


config_stub = ConfigStub()


def test_run_mutation_tests_thread_synchronization(monkeypatch):
# arrange
total_mutants = 3
Expand Down Expand Up @@ -80,10 +84,12 @@ def progress_mock_register(*_):

close_active_queues()


@fixture
def testpatches_path(testdata: Path):
return testdata / "test_patches"


def test_read_patch_data_new_empty_file_not_in_the_list(testpatches_path: Path):
# arrange
new_empty_file_name = "new_empty_file.txt"
Expand All @@ -95,6 +101,7 @@ def test_read_patch_data_new_empty_file_not_in_the_list(testpatches_path: Path):
# assert
assert not new_empty_file_name in new_empty_file_changes


def test_read_patch_data_removed_empty_file_not_in_the_list(testpatches_path: Path):
# arrange
existing_empty_file_name = "existing_empty_file.txt"
Expand All @@ -106,6 +113,7 @@ def test_read_patch_data_removed_empty_file_not_in_the_list(testpatches_path: Pa
# assert
assert existing_empty_file_name not in remove_empty_file_changes


def test_read_patch_data_renamed_empty_file_not_in_the_list(testpatches_path: Path):
# arrange
renamed_empty_file_name = "renamed_existing_empty_file.txt"
Expand All @@ -117,6 +125,7 @@ def test_read_patch_data_renamed_empty_file_not_in_the_list(testpatches_path: Pa
# assert
assert renamed_empty_file_name not in renamed_empty_file_changes


def test_read_patch_data_added_line_is_in_the_list(testpatches_path: Path):
# arrange
file_name = "existing_file.txt"
Expand All @@ -129,6 +138,7 @@ def test_read_patch_data_added_line_is_in_the_list(testpatches_path: Path):
assert file_name in file_changes
assert file_changes[file_name] == {3} # line is added between second and third


def test_read_patch_data_edited_line_is_in_the_list(testpatches_path: Path):
# arrange
file_name = "existing_file.txt"
Expand All @@ -141,6 +151,7 @@ def test_read_patch_data_edited_line_is_in_the_list(testpatches_path: Path):
assert file_name in file_changes
assert file_changes[file_name] == {2} # line is added between 2nd and 3rd


def test_read_patch_data_edited_line_in_subfolder_is_in_the_list(testpatches_path: Path):
# arrange
file_name = os.path.join("sub", "existing_file.txt") # unix will use "/", windows "\" to join
Expand All @@ -153,6 +164,7 @@ def test_read_patch_data_edited_line_in_subfolder_is_in_the_list(testpatches_pat
assert file_name in file_changes
assert file_changes[file_name] == {2} # line is added between 2nd and 3rd


def test_read_patch_data_renamed_file_edited_line_is_in_the_list(testpatches_path: Path):
# arrange
original_file_name = "existing_file.txt"
Expand All @@ -167,6 +179,7 @@ def test_read_patch_data_renamed_file_edited_line_is_in_the_list(testpatches_pat
assert new_file_name in file_changes
assert file_changes[new_file_name] == {3} # 3rd line is edited


def test_read_patch_data_mutliple_files(testpatches_path: Path):
# arrange
expected_changes = {
Expand Down
1 change: 1 addition & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ def test_html_output(surviving_mutants_filesystem):
'<tr><td><a href="foo.py.html">foo.py</a></td><td>2</td><td>0</td><td>0</td><td>0.00</td><td>2</td>'
'</table></body></html>')


def test_html_custom_output(surviving_mutants_filesystem):
result = CliRunner().invoke(climain, ['run', '--paths-to-mutate=foo.py', "--test-time-base=15.0"], catch_exceptions=False)
print(repr(result.output))
Expand Down

0 comments on commit fbff8e7

Please sign in to comment.