commit
1410d3dc9a
|
@ -1,9 +1,7 @@
|
||||||
|
|
||||||
.. _mark:
|
.. _mark:
|
||||||
|
|
||||||
Marking test functions with attributes
|
Marking test functions with attributes
|
||||||
=================================================================
|
======================================
|
||||||
|
|
||||||
|
|
||||||
By using the ``pytest.mark`` helper you can easily set
|
By using the ``pytest.mark`` helper you can easily set
|
||||||
metadata on your test functions. There are
|
metadata on your test functions. There are
|
||||||
|
@ -164,4 +162,4 @@ More details can be found in the `original PR <https://github.com/pytest-dev/pyt
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
in a future major relase of pytest we will introduce class based markers,
|
in a future major relase of pytest we will introduce class based markers,
|
||||||
at which point markers will no longer be limited to instances of :py:class:`Mark`
|
at which point markers will no longer be limited to instances of :py:class:`Mark`.
|
||||||
|
|
|
@ -223,7 +223,6 @@ import ``helper.py`` normally. The contents of
|
||||||
pytest.register_assert_rewrite("pytest_foo.helper")
|
pytest.register_assert_rewrite("pytest_foo.helper")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Requiring/Loading plugins in a test module or conftest file
|
Requiring/Loading plugins in a test module or conftest file
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -1021,6 +1021,7 @@ def fixture(scope="function", params=None, autouse=False, ids=None, name=None):
|
||||||
:arg params: an optional list of parameters which will cause multiple
|
:arg params: an optional list of parameters which will cause multiple
|
||||||
invocations of the fixture function and all of the tests
|
invocations of the fixture function and all of the tests
|
||||||
using it.
|
using it.
|
||||||
|
The current parameter is available in ``request.param``.
|
||||||
|
|
||||||
:arg autouse: if True, the fixture func is activated for all tests that
|
:arg autouse: if True, the fixture func is activated for all tests that
|
||||||
can see it. If False (the default) then an explicit
|
can see it. If False (the default) then an explicit
|
||||||
|
|
|
@ -7,6 +7,7 @@ import sys
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
import pytest
|
||||||
from _pytest import python
|
from _pytest import python
|
||||||
from _pytest import runner
|
from _pytest import runner
|
||||||
from _pytest import unittest
|
from _pytest import unittest
|
||||||
|
@ -26,7 +27,7 @@ def pytest_runtest_makereport(item, call):
|
||||||
if call.excinfo and call.excinfo.errisinstance(get_skip_exceptions()):
|
if call.excinfo and call.excinfo.errisinstance(get_skip_exceptions()):
|
||||||
# let's substitute the excinfo with a pytest.skip one
|
# let's substitute the excinfo with a pytest.skip one
|
||||||
call2 = runner.CallInfo.from_call(
|
call2 = runner.CallInfo.from_call(
|
||||||
lambda: runner.skip(six.text_type(call.excinfo.value)), call.when
|
lambda: pytest.skip(six.text_type(call.excinfo.value)), call.when
|
||||||
)
|
)
|
||||||
call.excinfo = call2.excinfo
|
call.excinfo = call2.excinfo
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ from .reports import CollectReport
|
||||||
from .reports import TestReport
|
from .reports import TestReport
|
||||||
from _pytest._code.code import ExceptionInfo
|
from _pytest._code.code import ExceptionInfo
|
||||||
from _pytest.outcomes import Exit
|
from _pytest.outcomes import Exit
|
||||||
from _pytest.outcomes import skip
|
|
||||||
from _pytest.outcomes import Skipped
|
from _pytest.outcomes import Skipped
|
||||||
from _pytest.outcomes import TEST_OUTCOME
|
from _pytest.outcomes import TEST_OUTCOME
|
||||||
|
|
||||||
|
@ -183,7 +182,7 @@ def call_and_report(item, when, log=True, **kwds):
|
||||||
def check_interactive_exception(call, report):
|
def check_interactive_exception(call, report):
|
||||||
return call.excinfo and not (
|
return call.excinfo and not (
|
||||||
hasattr(report, "wasxfail")
|
hasattr(report, "wasxfail")
|
||||||
or call.excinfo.errisinstance(skip.Exception)
|
or call.excinfo.errisinstance(Skipped)
|
||||||
or call.excinfo.errisinstance(bdb.BdbQuit)
|
or call.excinfo.errisinstance(bdb.BdbQuit)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue