summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2020-08-01 11:03:47 -0300
committerGitHub <noreply@github.com>2020-08-01 11:03:47 -0300
commit6882c0368b14e979642fdec0721a9922ba568074 (patch)
treeca949f8c06583f5096c5060f69c9f88aac5ce780 /testing
parent07f7372affcb19d4df35e3e214de771864af50c0 (diff)
parent8d98de8f8aef70a68ec98c1dd7ed0291efb37429 (diff)
downloadpytest-6882c0368b14e979642fdec0721a9922ba568074.tar.gz
Merge pull request #7593 from bluetech/typing-no-implicit-reexport
typing: set no_implicit_reexport
Diffstat (limited to 'testing')
-rw-r--r--testing/python/collect.py4
-rw-r--r--testing/python/fixtures.py17
-rw-r--r--testing/python/integration.py6
-rw-r--r--testing/python/metafunc.py12
-rw-r--r--testing/test_mark.py2
5 files changed, 22 insertions, 19 deletions
diff --git a/testing/python/collect.py b/testing/python/collect.py
index f64a14629..ed778c265 100644
--- a/testing/python/collect.py
+++ b/testing/python/collect.py
@@ -1018,7 +1018,7 @@ class TestTracebackCutting:
See: https://bitbucket.org/pytest-dev/py/issues/71
This fixes #995.
"""
- from _pytest.python import filter_traceback
+ from _pytest._code import filter_traceback
try:
ns = {} # type: Dict[str, Any]
@@ -1038,7 +1038,7 @@ class TestTracebackCutting:
In this case, one of the files in the traceback no longer exists.
This fixes #1133.
"""
- from _pytest.python import filter_traceback
+ from _pytest._code import filter_traceback
testdir.syspathinsert()
testdir.makepyfile(
diff --git a/testing/python/fixtures.py b/testing/python/fixtures.py
index 119c7deda..70370915b 100644
--- a/testing/python/fixtures.py
+++ b/testing/python/fixtures.py
@@ -3,6 +3,7 @@ import textwrap
import pytest
from _pytest import fixtures
+from _pytest.compat import getfuncargnames
from _pytest.config import ExitCode
from _pytest.fixtures import FixtureRequest
from _pytest.pathlib import Path
@@ -15,22 +16,22 @@ def test_getfuncargnames_functions():
def f():
raise NotImplementedError()
- assert not fixtures.getfuncargnames(f)
+ assert not getfuncargnames(f)
def g(arg):
raise NotImplementedError()
- assert fixtures.getfuncargnames(g) == ("arg",)
+ assert getfuncargnames(g) == ("arg",)
def h(arg1, arg2="hello"):
raise NotImplementedError()
- assert fixtures.getfuncargnames(h) == ("arg1",)
+ assert getfuncargnames(h) == ("arg1",)
def j(arg1, arg2, arg3="hello"):
raise NotImplementedError()
- assert fixtures.getfuncargnames(j) == ("arg1", "arg2")
+ assert getfuncargnames(j) == ("arg1", "arg2")
def test_getfuncargnames_methods():
@@ -40,7 +41,7 @@ def test_getfuncargnames_methods():
def f(self, arg1, arg2="hello"):
raise NotImplementedError()
- assert fixtures.getfuncargnames(A().f) == ("arg1",)
+ assert getfuncargnames(A().f) == ("arg1",)
def test_getfuncargnames_staticmethod():
@@ -51,7 +52,7 @@ def test_getfuncargnames_staticmethod():
def static(arg1, arg2, x=1):
raise NotImplementedError()
- assert fixtures.getfuncargnames(A.static, cls=A) == ("arg1", "arg2")
+ assert getfuncargnames(A.static, cls=A) == ("arg1", "arg2")
def test_getfuncargnames_partial():
@@ -64,7 +65,7 @@ def test_getfuncargnames_partial():
class T:
test_ok = functools.partial(check, i=2)
- values = fixtures.getfuncargnames(T().test_ok, name="test_ok")
+ values = getfuncargnames(T().test_ok, name="test_ok")
assert values == ("arg1", "arg2")
@@ -78,7 +79,7 @@ def test_getfuncargnames_staticmethod_partial():
class T:
test_ok = staticmethod(functools.partial(check, i=2))
- values = fixtures.getfuncargnames(T().test_ok, name="test_ok")
+ values = getfuncargnames(T().test_ok, name="test_ok")
assert values == ("arg1", "arg2")
diff --git a/testing/python/integration.py b/testing/python/integration.py
index 537057484..854593a65 100644
--- a/testing/python/integration.py
+++ b/testing/python/integration.py
@@ -1,8 +1,8 @@
from typing import Any
import pytest
-from _pytest import python
from _pytest import runner
+from _pytest._code import getfslineno
class TestOEJSKITSpecials:
@@ -87,8 +87,8 @@ def test_wrapped_getfslineno() -> None:
def wrapped_func(x, y, z):
pass
- fs, lineno = python.getfslineno(wrapped_func)
- fs2, lineno2 = python.getfslineno(wrap)
+ fs, lineno = getfslineno(wrapped_func)
+ fs2, lineno2 = getfslineno(wrap)
assert lineno > lineno2, "getfslineno does not unwrap correctly"
diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py
index 4e6cfaf91..d254dd3fb 100644
--- a/testing/python/metafunc.py
+++ b/testing/python/metafunc.py
@@ -19,6 +19,8 @@ from hypothesis import strategies
import pytest
from _pytest import fixtures
from _pytest import python
+from _pytest.compat import _format_args
+from _pytest.compat import getfuncargnames
from _pytest.outcomes import fail
from _pytest.pytester import Testdir
from _pytest.python import _idval
@@ -41,7 +43,7 @@ class TestMetafunc:
obj = attr.ib()
_nodeid = attr.ib()
- names = fixtures.getfuncargnames(func)
+ names = getfuncargnames(func)
fixtureinfo = FuncFixtureInfoMock(names) # type: Any
definition = DefinitionMock._create(func, "mock::nodeid") # type: Any
return python.Metafunc(definition, fixtureinfo, config)
@@ -954,22 +956,22 @@ class TestMetafunc:
def function1():
pass
- assert fixtures._format_args(function1) == "()"
+ assert _format_args(function1) == "()"
def function2(arg1):
pass
- assert fixtures._format_args(function2) == "(arg1)"
+ assert _format_args(function2) == "(arg1)"
def function3(arg1, arg2="qwe"):
pass
- assert fixtures._format_args(function3) == "(arg1, arg2='qwe')"
+ assert _format_args(function3) == "(arg1, arg2='qwe')"
def function4(arg1, *args, **kwargs):
pass
- assert fixtures._format_args(function4) == "(arg1, *args, **kwargs)"
+ assert _format_args(function4) == "(arg1, *args, **kwargs)"
class TestMetafuncFunctional:
diff --git a/testing/test_mark.py b/testing/test_mark.py
index f35660093..f00c1330e 100644
--- a/testing/test_mark.py
+++ b/testing/test_mark.py
@@ -4,8 +4,8 @@ from unittest import mock
import pytest
from _pytest.config import ExitCode
-from _pytest.mark import EMPTY_PARAMETERSET_OPTION
from _pytest.mark import MarkGenerator as Mark
+from _pytest.mark.structures import EMPTY_PARAMETERSET_OPTION
from _pytest.nodes import Collector
from _pytest.nodes import Node