Skip to content

Commit 569ed24

Browse files
committed
Marking some tests as bad because they take too long
1 parent 45f39b2 commit 569ed24

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/test_mft_analyzer.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,26 @@ async def test_analyze(analyzer, mock_mft_file, mock_mft_record):
4343
assert analyzer.stats['files'] == 1
4444

4545
@pytest.mark.asyncio
46-
@pytest.mark.parametrize("export_format", ["csv", "json", "xml", "excel", "body", "timeline", "l2t"])
47-
async def test_analyze_with_different_export_formats(export_format, mock_mft_file, mock_mft_record):
46+
@pytest.mark.parametrize("export_format", ["csv", "body", "timeline", "l2t"])
47+
async def test_analyze_with_different_export_formats_fast(export_format, mock_mft_file, mock_mft_record):
48+
analyzer = MftAnalyzer("test.mft", f"output.{export_format}", debug=0, verbosity=0, compute_hashes=False, export_format=export_format)
49+
50+
with patch("builtins.open", mock_open(read_data=mock_mft_file)), \
51+
patch("os.path.exists", return_value=True), \
52+
patch("os.path.getsize", return_value=len(mock_mft_file)):
53+
with patch("src.analyzeMFT.mft_analyzer.MftRecord", return_value=mock_mft_record):
54+
with patch("src.analyzeMFT.mft_analyzer.get_writer") as mock_get_writer:
55+
mock_writer = AsyncMock()
56+
mock_get_writer.return_value = mock_writer
57+
await analyzer.analyze()
58+
59+
mock_get_writer.assert_called_once_with(export_format)
60+
mock_writer.assert_called_once()
61+
62+
@pytest.mark.asyncio
63+
@pytest.mark.slow
64+
@pytest.mark.parametrize("export_format", ["json", "xml", "excel"])
65+
async def test_analyze_with_different_export_formats_slow(export_format, mock_mft_file, mock_mft_record):
4866
analyzer = MftAnalyzer("test.mft", f"output.{export_format}", debug=0, verbosity=0, compute_hashes=False, export_format=export_format)
4967

5068
with patch("builtins.open", mock_open(read_data=mock_mft_file)), \
@@ -216,6 +234,7 @@ async def test_handle_interrupt(analyzer):
216234
mock_loop.return_value.add_signal_handler.assert_called()
217235

218236
@pytest.mark.asyncio
237+
@pytest.mark.slow
219238
async def test_analyze_with_all_flags(mock_mft_file, mock_mft_record):
220239
analyzer = MftAnalyzer("test.mft", "output.csv", debug=1, verbosity=0, compute_hashes=True, export_format="json")
221240

0 commit comments

Comments
 (0)