File: test_same_function_name.py

package info (click to toggle)
pytest-bdd 7.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 540 kB
  • sloc: python: 3,535; makefile: 134
file content (33 lines) | stat: -rw-r--r-- 809 bytes parent folder | download
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
"""Function name same as step name."""

import textwrap


def test_when_function_name_same_as_step_name(pytester):
    pytester.makefile(
        ".feature",
        same_name=textwrap.dedent(
            """\
            Feature: Function name same as step name
                Scenario: When function name same as step name
                    When something
            """
        ),
    )
    pytester.makepyfile(
        textwrap.dedent(
            """\
        from pytest_bdd import when, scenario

        @scenario("same_name.feature", "When function name same as step name")
        def test_same_name():
            pass

        @when("something")
        def _():
            return "something"
        """
        )
    )
    result = pytester.runpytest()
    result.assert_outcomes(passed=1)