Skip to content

Commit 98c899c

Browse files
authored
Merge pull request #6245 from blueyed/tests-_idval
testing/python/metafunc.py: import _idval once
2 parents f1224a0 + ccb3ef3 commit 98c899c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

testing/python/metafunc.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pytest
1010
from _pytest import fixtures
1111
from _pytest import python
12+
from _pytest.python import _idval
1213

1314

1415
class TestMetafunc:
@@ -209,8 +210,6 @@ class A:
209210
deadline=400.0
210211
) # very close to std deadline and CI boxes are not reliable in CPU power
211212
def test_idval_hypothesis(self, value):
212-
from _pytest.python import _idval
213-
214213
escaped = _idval(value, "a", 6, None, item=None, config=None)
215214
assert isinstance(escaped, str)
216215
escaped.encode("ascii")
@@ -221,8 +220,6 @@ def test_unicode_idval(self):
221220
escapes if they're not.
222221
223222
"""
224-
from _pytest.python import _idval
225-
226223
values = [
227224
("", ""),
228225
("ascii", "ascii"),
@@ -242,7 +239,6 @@ def test_unicode_idval_with_config(self):
242239
disable_test_id_escaping_and_forfeit_all_rights_to_community_support
243240
option. (#5294)
244241
"""
245-
from _pytest.python import _idval
246242

247243
class MockConfig:
248244
def __init__(self, config):
@@ -274,8 +270,6 @@ def test_bytes_idval(self):
274270
"binary escape", where any byte < 127 is escaped into its hex form.
275271
- python3: bytes objects are always escaped using "binary escape".
276272
"""
277-
from _pytest.python import _idval
278-
279273
values = [
280274
(b"", ""),
281275
(b"\xc3\xb4\xff\xe4", "\\xc3\\xb4\\xff\\xe4"),
@@ -289,7 +283,6 @@ def test_class_or_function_idval(self):
289283
"""unittest for the expected behavior to obtain ids for parametrized
290284
values that are classes or functions: their __name__.
291285
"""
292-
from _pytest.python import _idval
293286

294287
class TestClass:
295288
pass

0 commit comments

Comments
 (0)