summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonny Pfannschmidt <ronny.pfannschmidt@redhat.com>2017-02-28 17:56:12 +0100
committerRonny Pfannschmidt <ronny.pfannschmidt@redhat.com>2017-03-28 11:45:06 +0200
commitae234786eabeae89ece706f826dcac5dcdaca012 (patch)
treefa5fea2891db4016db1b7790d860617f91788ce8
parent99c8f2d4035a15543fefc6cef2c3abb883a97d23 (diff)
downloadpytest-ae234786eabeae89ece706f826dcac5dcdaca012.tar.gz
remove pytest_namespace from _pytest.python
-rw-r--r--_pytest/python.py22
-rw-r--r--pytest.py4
2 files changed, 10 insertions, 16 deletions
diff --git a/_pytest/python.py b/_pytest/python.py
index e763aa888..61000676e 100644
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -22,6 +22,7 @@ from _pytest.compat import (
get_real_func, getfslineno, safe_getattr,
getlocation, enum,
)
+from _pytest.runner import fail
cutdir1 = py.path.local(pluggy.__file__.rstrip("oc"))
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 "
)
-@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)
def pytest_pyfunc_call(pyfuncitem):
@@ -1234,7 +1220,11 @@ def raises(expected_exception, *args, **kwargs):
func(*args[1:], **kwargs)
except expected_exception:
return _pytest._code.ExceptionInfo()
- pytest.fail(message)
+ fail(message)
+
+raises.Exception = fail.Exception
+
+
class RaisesContext(object):
def __init__(self, expected_exception, message, match_expr):
diff --git a/pytest.py b/pytest.py
index a072b49ae..8185d6503 100644
--- a/pytest.py
+++ b/pytest.py
@@ -55,6 +55,10 @@ from _pytest.mark import MARK_GEN as mark
from _pytest.skipping import xfail
from _pytest.main import Item, Collector, File, Session
from _pytest.fixtures import fillfixtures as _fillfuncargs
+from _pytest.python import (
+ raises, approx,
+ Module, Class, Instance, Function, Generator,
+)
set_trace = __pytestPDB.set_trace