remove pytest_namespace from _pytest.python

This commit is contained in:
Ronny Pfannschmidt 2017-02-28 17:56:12 +01:00
parent 99c8f2d403
commit ae234786ea
2 changed files with 10 additions and 16 deletions

View File

@ -22,6 +22,7 @@ from _pytest.compat import (
get_real_func, getfslineno, safe_getattr, get_real_func, getfslineno, safe_getattr,
getlocation, enum, getlocation, enum,
) )
from _pytest.runner import fail
cutdir1 = py.path.local(pluggy.__file__.rstrip("oc")) cutdir1 = py.path.local(pluggy.__file__.rstrip("oc"))
cutdir2 = py.path.local(_pytest.__file__).dirpath() cutdir2 = py.path.local(_pytest.__file__).dirpath()
@ -126,21 +127,6 @@ def pytest_configure(config):
"all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures " "all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures "
) )
@pytest.hookimpl(trylast=True)
def pytest_namespace():
raises.Exception = pytest.fail.Exception
return {
'raises': raises,
'approx': approx,
'collect': {
'Module': Module,
'Class': Class,
'Instance': Instance,
'Function': Function,
'Generator': Generator,
}
}
@pytest.hookimpl(trylast=True) @pytest.hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem): def pytest_pyfunc_call(pyfuncitem):
@ -1234,7 +1220,11 @@ def raises(expected_exception, *args, **kwargs):
func(*args[1:], **kwargs) func(*args[1:], **kwargs)
except expected_exception: except expected_exception:
return _pytest._code.ExceptionInfo() return _pytest._code.ExceptionInfo()
pytest.fail(message) fail(message)
raises.Exception = fail.Exception
class RaisesContext(object): class RaisesContext(object):
def __init__(self, expected_exception, message, match_expr): def __init__(self, expected_exception, message, match_expr):

View File

@ -55,6 +55,10 @@ from _pytest.mark import MARK_GEN as mark
from _pytest.skipping import xfail from _pytest.skipping import xfail
from _pytest.main import Item, Collector, File, Session from _pytest.main import Item, Collector, File, Session
from _pytest.fixtures import fillfixtures as _fillfuncargs from _pytest.fixtures import fillfixtures as _fillfuncargs
from _pytest.python import (
raises, approx,
Module, Class, Instance, Function, Generator,
)
set_trace = __pytestPDB.set_trace set_trace = __pytestPDB.set_trace