base path for feature files

This commit is contained in:
Anatoly Bubenkov 2013-05-28 17:11:47 +02:00
parent 528a36d81e
commit 106e5633db
4 changed files with 9 additions and 7 deletions

View File

@ -25,12 +25,7 @@ def scenario(feature_name, scenario_name):
def _scenario(request):
# Get the feature
try:
base_path = request.getfuncargvalue('pytest_bdd_feature_path')
except LookupError:
# TODO: add concrete exception type, for now it's not clear how to import FixtureLookupErrorRepr from pytest
base_path = op.dirname(request.module.__file__)
base_path = request.getfuncargvalue('pytestbdd_feature_path')
feature_path = op.abspath(op.join(base_path, feature_name))
feature = Feature.get_feature(feature_path)

View File

@ -29,6 +29,12 @@ setup(
install_requires=[
'pytest',
],
# the following makes a plugin available to py.test
entry_points = {
'pytest11': [
'pytest-bdd = pytest_bdd.plugin',
]
},
tests_require=['mock'],
packages=['pytest_bdd'],
)

View File

@ -1,6 +1,7 @@
"""Configuration for pytest runner."""
from pytest_bdd import given, when
from pytest_bdd.plugin import pytestbdd_feature_path
pytest_plugins = 'pytester'

View File

@ -14,7 +14,7 @@ def scenario_name(request):
@pytest.fixture
def pytest_bdd_feature_path():
def pytestbdd_feature_path():
return '/does/not/exist'