Skip to content

Commit

Permalink
Fix PytestRemovedIn8Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kerrickstaley committed Nov 26, 2023
1 parent d04690e commit a58275b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/test_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ def test_ok():
model=my_model,
fields=['Capital of Argentina', 'Buenos Aires'])

with pytest.warns(None) as warn_recorder:
# https://stackoverflow.com/a/45671804
with warnings.catch_warnings():
warnings.simplefilter('error')
my_note.write_to_db(mock.MagicMock(), mock.MagicMock(), mock.MagicMock(), itertools.count(int(time.time() * 1000)))

# Should be no warnings issued.
assert not warn_recorder


class TestTags:
def test_init(self):
Expand Down Expand Up @@ -262,12 +261,11 @@ def test_suppress_warnings(recwarn):
model=my_model,
fields=['Capital of <$> Argentina', 'Buenos Aires'])

with pytest.warns(None) as warn_recorder:
with warnings.catch_warnings():
warnings.simplefilter('error')
warnings.filterwarnings('ignore', message='^Field contained the following invalid HTML tags', module='genanki')
my_note.write_to_db(mock.MagicMock(), mock.MagicMock(), mock.MagicMock(), itertools.count(int(time.time() * 1000)))

assert not warn_recorder


def test_furigana_field():
# Fields like {{furigana:Reading}} are supported by the Japanese Support plugin:
Expand Down

0 comments on commit a58275b

Please sign in to comment.