Skip to content

Commit 7671290

Browse files
sliwinski-miloszyoutux
authored andcommitted
bdd_feature_base_dir renamed into bdd_features_base_dir
1 parent ed45c5e commit 7671290

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

pytest_bdd/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def pytest_addoption(parser):
3737

3838

3939
def add_bdd_ini(parser):
40-
parser.addini('bdd_feature_base_dir',
41-
'Base feature directory.')
40+
parser.addini('bdd_features_base_dir',
41+
'Base features directory.')
4242
parser.addini('bdd_strict_gherkin',
4343
'Parse features to be strict gherkin.',
4444
type='bool', default=True)

pytest_bdd/scenario.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def decorator(_pytestbdd_function):
258258

259259

260260
def scenario(feature_name, scenario_name, encoding="utf-8", example_converters=None,
261-
caller_module=None, caller_function=None, feature_base_dir=None, strict_gherkin=None):
261+
caller_module=None, caller_function=None, features_base_dir=None, strict_gherkin=None):
262262
"""Scenario decorator.
263263
264264
:param str feature_name: Feature file name. Absolute or relative to the configured feature base path.
@@ -272,11 +272,11 @@ def scenario(feature_name, scenario_name, encoding="utf-8", example_converters=N
272272
caller_function = caller_function or get_caller_function()
273273

274274
# Get the feature
275-
if feature_base_dir is None:
276-
feature_base_dir = get_feature_base_dir(caller_module)
275+
if features_base_dir is None:
276+
features_base_dir = get_features_base_dir(caller_module)
277277
if strict_gherkin is None:
278278
strict_gherkin = get_strict_gherkin()
279-
feature = Feature.get_feature(feature_base_dir, feature_name, encoding=encoding, strict_gherkin=strict_gherkin)
279+
feature = Feature.get_feature(features_base_dir, feature_name, encoding=encoding, strict_gherkin=strict_gherkin)
280280

281281
# Get the sc_enario
282282
try:
@@ -306,9 +306,9 @@ def scenario(feature_name, scenario_name, encoding="utf-8", example_converters=N
306306
)
307307

308308

309-
def get_feature_base_dir(caller_module):
309+
def get_features_base_dir(caller_module):
310310
default_base_dir = os.path.dirname(caller_module.__file__)
311-
return get_from_ini('bdd_feature_base_dir', default_base_dir)
311+
return get_from_ini('bdd_features_base_dir', default_base_dir)
312312

313313

314314
def get_from_ini(key, default):
@@ -352,9 +352,9 @@ def scenarios(*feature_paths, **kwargs):
352352
frame = inspect.stack()[1]
353353
module = inspect.getmodule(frame[0])
354354

355-
feature_base_dir = kwargs.get('feature_base_dir')
356-
if feature_base_dir is None:
357-
feature_base_dir = get_feature_base_dir(module)
355+
features_base_dir = kwargs.get('features_base_dir')
356+
if features_base_dir is None:
357+
features_base_dir = get_features_base_dir(module)
358358

359359
strict_gherkin = kwargs.get('strict_gherkin')
360360
if strict_gherkin is None:
@@ -363,7 +363,7 @@ def scenarios(*feature_paths, **kwargs):
363363
abs_feature_paths = []
364364
for path in feature_paths:
365365
if not os.path.isabs(path):
366-
path = os.path.abspath(os.path.join(feature_base_dir, path))
366+
path = os.path.abspath(os.path.join(features_base_dir, path))
367367
abs_feature_paths.append(path)
368368
found = False
369369

tests/feature/test_feature_base_dir.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_feature_path_by_param_ok(testdir, base_dir):
5151
def prepare_testdir(testdir, ini_base_dir):
5252
testdir.makeini("""
5353
[pytest]
54-
bdd_feature_base_dir={}
54+
bdd_features_base_dir={}
5555
""".format(ini_base_dir))
5656

5757
feature_file = testdir.mkdir('features').join('steps.feature')
@@ -112,20 +112,20 @@ def test_ok_by_ini(scenario_name, multiple):
112112
def test_not_found_by_param(scenario_name, param_base_dir, multiple):
113113
with pytest.raises(IOError) as exc:
114114
if multiple:
115-
scenarios(FEATURE, feature_base_dir=param_base_dir)
115+
scenarios(FEATURE, features_base_dir=param_base_dir)
116116
else:
117-
scenario(FEATURE, scenario_name, feature_base_dir=param_base_dir)
117+
scenario(FEATURE, scenario_name, features_base_dir=param_base_dir)
118118
assert os.path.abspath(os.path.join(param_base_dir, FEATURE)) in str(exc.value)
119119
120120
121121
@pytest.mark.parametrize(
122122
'multiple', [True, False]
123123
)
124124
def test_ok_by_param(scenario_name, multiple):
125-
# Shouldn't raise any exception no matter of bdd_feature_base_dir in ini
125+
# Shouldn't raise any exception no matter of bdd_features_base_dir in ini
126126
if multiple:
127-
scenarios(FEATURE, feature_base_dir='features')
127+
scenarios(FEATURE, features_base_dir='features')
128128
else:
129-
scenario(FEATURE, scenario_name, feature_base_dir='features')
129+
scenario(FEATURE, scenario_name, features_base_dir='features')
130130
131131
""".format(ini_base_dir))

0 commit comments

Comments
 (0)