File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,35 @@ def _():
397397 ]
398398
399399
400+ def test_no_usefixtures_warning_when_no_args (pytester ):
401+ """Test that no PytestWarning about usefixtures() without arguments is emitted
402+ when scenario functions have no arguments (e.g. when using scenarios()).
403+
404+ Regression test for https://github.com/pytest-dev/pytest-bdd/issues/XXX
405+ """
406+ pytester .makefile (
407+ ".feature" ,
408+ simple = """
409+ Feature: Simple feature
410+ Scenario: Simple scenario with no args
411+ Given I have a bar
412+ """ ,
413+ )
414+ pytester .makepyfile (
415+ """
416+ from pytest_bdd import scenarios, given
417+
418+ scenarios("simple.feature")
419+
420+ @given("I have a bar")
421+ def _():
422+ return "bar"
423+ """
424+ )
425+ result = pytester .runpytest ("-W" , "error::pytest.PytestWarning" )
426+ result .assert_outcomes (passed = 1 )
427+
428+
400429def test_default_value_is_used_as_fallback (pytester ):
401430 """Test that the default value for a step implementation is only used as a fallback."""
402431 pytester .makefile (
You can’t perform that action at this time.
0 commit comments