testing/python/metafunc.py: import _idval once

This commit is contained in:
Daniel Hahler 2019-11-20 18:02:00 +01:00
parent 5b3867fd65
commit ccb3ef3b33
1 changed files with 1 additions and 8 deletions

View File

@ -9,6 +9,7 @@ from hypothesis import strategies
import pytest import pytest
from _pytest import fixtures from _pytest import fixtures
from _pytest import python from _pytest import python
from _pytest.python import _idval
class TestMetafunc: class TestMetafunc:
@ -209,8 +210,6 @@ class TestMetafunc:
deadline=400.0 deadline=400.0
) # very close to std deadline and CI boxes are not reliable in CPU power ) # very close to std deadline and CI boxes are not reliable in CPU power
def test_idval_hypothesis(self, value): def test_idval_hypothesis(self, value):
from _pytest.python import _idval
escaped = _idval(value, "a", 6, None, item=None, config=None) escaped = _idval(value, "a", 6, None, item=None, config=None)
assert isinstance(escaped, str) assert isinstance(escaped, str)
escaped.encode("ascii") escaped.encode("ascii")
@ -221,8 +220,6 @@ class TestMetafunc:
escapes if they're not. escapes if they're not.
""" """
from _pytest.python import _idval
values = [ values = [
("", ""), ("", ""),
("ascii", "ascii"), ("ascii", "ascii"),
@ -242,7 +239,6 @@ class TestMetafunc:
disable_test_id_escaping_and_forfeit_all_rights_to_community_support disable_test_id_escaping_and_forfeit_all_rights_to_community_support
option. (#5294) option. (#5294)
""" """
from _pytest.python import _idval
class MockConfig: class MockConfig:
def __init__(self, config): def __init__(self, config):
@ -274,8 +270,6 @@ class TestMetafunc:
"binary escape", where any byte < 127 is escaped into its hex form. "binary escape", where any byte < 127 is escaped into its hex form.
- python3: bytes objects are always escaped using "binary escape". - python3: bytes objects are always escaped using "binary escape".
""" """
from _pytest.python import _idval
values = [ values = [
(b"", ""), (b"", ""),
(b"\xc3\xb4\xff\xe4", "\\xc3\\xb4\\xff\\xe4"), (b"\xc3\xb4\xff\xe4", "\\xc3\\xb4\\xff\\xe4"),
@ -289,7 +283,6 @@ class TestMetafunc:
"""unittest for the expected behavior to obtain ids for parametrized """unittest for the expected behavior to obtain ids for parametrized
values that are classes or functions: their __name__. values that are classes or functions: their __name__.
""" """
from _pytest.python import _idval
class TestClass: class TestClass:
pass pass