/usr/lib/python2.7/dist-packages/pytest_bdd/plugin.py is in python-pytest-bdd 2.18.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | """Pytest plugin entry point. Used for any fixtures needed."""
import pytest
from . import given, when, then
from . import cucumber_json
from . import generation
from . import reporting
from . import gherkin_terminal_reporter
from .fixtures import *
def pytest_addhooks(pluginmanager):
"""Register plugin hooks."""
from pytest_bdd import hooks
try:
# pytest >= 2.8
pluginmanager.add_hookspecs(hooks)
except AttributeError:
# pytest < 2.8
pluginmanager.addhooks(hooks)
@given('trace')
@when('trace')
@then('trace')
def trace():
"""Enter pytest's pdb trace."""
pytest.set_trace()
def pytest_addoption(parser):
"""Add pytest-bdd options."""
cucumber_json.add_options(parser)
generation.add_options(parser)
gherkin_terminal_reporter.add_options(parser)
@pytest.mark.trylast
def pytest_configure(config):
"""Configure all subplugins."""
cucumber_json.configure(config)
gherkin_terminal_reporter.configure(config)
def pytest_unconfigure(config):
"""Unconfigure all subplugins."""
cucumber_json.unconfigure(config)
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
outcome = yield
reporting.runtest_makereport(item, call, outcome.get_result())
@pytest.mark.tryfirst
def pytest_bdd_before_scenario(request, feature, scenario):
reporting.before_scenario(request, feature, scenario)
@pytest.mark.tryfirst
def pytest_bdd_step_error(request, feature, scenario, step, step_func, step_func_args, exception):
reporting.step_error(request, feature, scenario, step, step_func, step_func_args, exception)
@pytest.mark.tryfirst
def pytest_bdd_before_step(request, feature, scenario, step, step_func):
reporting.before_step(request, feature, scenario, step, step_func)
@pytest.mark.tryfirst
def pytest_bdd_after_step(request, feature, scenario, step, step_func, step_func_args):
reporting.after_step(request, feature, scenario, step, step_func, step_func_args)
def pytest_cmdline_main(config):
generation.cmdline_main(config)
def pytest_bdd_apply_tag(tag, function):
mark = getattr(pytest.mark, tag)
return mark(function)
|