Skip to content

Commit 865b32c

Browse files
committed
test: fix tests on Python < 3.11
Signed-off-by: Filipe Laíns <lains@riseup.net>
1 parent fe1c4bd commit 865b32c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/test_items.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,11 @@ def test_variableitem_compliance():
132132
with pytest.warns(hid_parser.HIDComplianceWarning):
133133
hid_parser.VariableItem(1, 2, 0, hid_parser.Usage(0x0001, 0x0001), -1, 1)
134134

135-
with warnings.catch_warnings(action='error'):
135+
# Python >= 3.11: with warnings.catch_warnings(action='error'):
136+
with warnings.catch_warnings():
137+
warnings.simplefilter('error')
136138
hid_parser.VariableItem(1, 2, 0, hid_parser.Usage(0x0001, 0x0030), -1, 1)
137-
138-
with warnings.catch_warnings(action='error'):
139139
hid_parser.VariableItem(1, 2, 0, hid_parser.Usage(0x0001, 0x0000), -1, 1)
140-
141-
with warnings.catch_warnings(action='error'):
142140
hid_parser.VariableItem(1, 2, 0, hid_parser.Usage(0x0000, 0x0000), -1, 1)
143141

144142

0 commit comments

Comments
 (0)