Skip to content

Commit

Permalink
Fixed failing test on engine that does not warn (#3196)
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Feb 5, 2024
1 parent 1ea147c commit 9821184
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/ignite/engine/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def limited_data_iterator():
self._test_check_triggered_events(limited_data_iterator(), max_epochs=1, epoch_length=100, exp_iter_stops=0)
self._test_check_triggered_events(limited_data_iterator(), max_epochs=10, epoch_length=10, exp_iter_stops=0)

# These tests will fail
# These tests should fail
with pytest.raises(AssertionError):
with pytest.warns(UserWarning, match=r"Data iterator can not provide data anymore"):
self._test_check_triggered_events(limited_data_iterator(), max_epochs=3, epoch_length=100)
Expand All @@ -649,8 +649,10 @@ def limited_data_iterator():
self._test_check_triggered_events(limited_data_iterator(), max_epochs=3, epoch_length=75)

with pytest.raises(AssertionError):
with pytest.warns(UserWarning, match=r"Data iterator can not provide data anymore"):
self._test_check_triggered_events(limited_data_iterator(), max_epochs=1, epoch_length=101)
# Below test does not raise "Data iterator can not provide data anymore" warning as the last
# epoch is equal max_epochs
# with pytest.warns(UserWarning, match=r"Data iterator can not provide data anymore"):
self._test_check_triggered_events(limited_data_iterator(), max_epochs=1, epoch_length=101)

def test_run_check_triggered_events_on_iterator(self):
self._test_run_check_triggered_events_on_iterator()
Expand Down

0 comments on commit 9821184

Please sign in to comment.