Skip to content

Commit 81ddbef

Browse files
committed
Use a syntax compatible with Python 3.8 for join context.
1 parent fb44cbf commit 81ddbef

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

importlib_resources/tests/test_functional.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
22
import os
3-
import contextlib
43

54
from .compat.py39 import warnings_helper
65

@@ -171,21 +170,17 @@ def test_contents(self):
171170
set(c),
172171
{'utf-8.file', 'utf-16.file', 'binary.file', 'subdirectory'},
173172
)
174-
with contextlib.ExitStack() as cm:
175-
cm.enter_context(self.assertRaises(OSError))
176-
cm.enter_context(
177-
warnings_helper.check_warnings((".*contents.*", DeprecationWarning))
178-
)
179-
173+
with self.assertRaises(OSError), warnings_helper.check_warnings((
174+
".*contents.*",
175+
DeprecationWarning,
176+
)):
180177
list(resources.contents(self.anchor01, 'utf-8.file'))
181178

182179
for path_parts in self._gen_resourcetxt_path_parts():
183-
with contextlib.ExitStack() as cm:
184-
cm.enter_context(self.assertRaises(OSError))
185-
cm.enter_context(
186-
warnings_helper.check_warnings((".*contents.*", DeprecationWarning))
187-
)
188-
180+
with self.assertRaises(OSError), warnings_helper.check_warnings((
181+
".*contents.*",
182+
DeprecationWarning,
183+
)):
189184
list(resources.contents(self.anchor01, *path_parts))
190185
with warnings_helper.check_warnings((".*contents.*", DeprecationWarning)):
191186
c = resources.contents(self.anchor01, 'subdirectory')

0 commit comments

Comments
 (0)