Skip to content

Commit 0eebeb9

Browse files
authored
tests: fix flaky test in test_get_used_objs (#10739)
Clear logs before assertions so that logs from other tests do not interfere with the test. Some destructors may also run in between due to GC, so hopefully this will fix that issue too, or reduce the chances of it happening. See https://github.com/iterative/dvc/actions/runs/14873217814/job/41775314725#step:6:97. ```console > assert first(caplog.messages) == expected_message E assert 'RC: discarding all clients' == "Output 'path... 'stage.dvc'." E E + RC: discarding all clients E - Output 'path'(stage: 'stage.dvc') is missing version info. Cache for it will not be collected. Use `dvc repro` to get your pipeline up to date. E - You can also use `dvc commit stage.dvc` to associate existing 'path' with stage: 'stage.dvc'. ```
1 parent 415d4bc commit 0eebeb9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/unit/output/test_output.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def test_get_used_objs(exists, expected_message, mocker, caplog):
101101
Output, "exists", new_callable=mocker.PropertyMock
102102
).return_value = exists
103103

104+
caplog.clear()
104105
with caplog.at_level(logging.WARNING, logger="dvc"):
105106
assert output.get_used_objs() == {}
106107
assert first(caplog.messages) == expected_message

0 commit comments

Comments
 (0)