Skip to content

Commit 4b647ab

Browse files
committed
Refactor tests for improved clarity and consistency
- Removed unnecessary imports and added newlines for better formatting in test_discovery.py. - Updated test names in test_gui.py for clarity and added a dummy test for GUI launch. - Ensured consistent formatting by adding newlines at the end of files where necessary.
1 parent 2c49ecb commit 4b647ab

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

tests/test_discovery.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import pytest
22
from ransomware.discovery.discoverer import FileDiscoverer
3-
import os
3+
44

55
def test_discover_files(tmp_path):
66
# Create some files
77
file1 = tmp_path / "file1.txt"
88
file2 = tmp_path / "file2.txt"
99
file1.write_text("test1")
1010
file2.write_text("test2")
11+
1112
discoverer = FileDiscoverer(str(tmp_path))
1213
files = discoverer.discover_files()
14+
1315
assert len(files) == 2
1416
assert any("file1.txt" in f for f in files)
15-
assert any("file2.txt" in f for f in files)
17+
assert any("file2.txt" in f for f in files)
18+

tests/test_encryptor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1+
# Either remove the blank line or ensure it's clean:
2+
# Just add an empty file with newline if nothing is written

tests/test_gui.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import pytest
2+
23
from ransomware.gui.main import RansomwareGUI
34

5+
46
@pytest.mark.gui
5-
def test_gui_launch(qtbot):
7+
def test_gui_launch_real(qtbot):
68
gui = RansomwareGUI(target_dir="/tmp/test")
79
qtbot.addWidget(gui)
810
gui.show()
911
assert gui.isVisible()
1012
assert "encrypted" in gui.title().lower()
1113
gui.close()
1214

13-
def test_gui_launch():
15+
16+
def test_gui_launch_dummy():
1417
# Dummy test for GUI launch
15-
assert True
18+
assert True
19+

0 commit comments

Comments
 (0)