forked from test_framework/pytest-bdd
added tests for fixture override
This commit is contained in:
parent
6d901125fc
commit
023f36c990
|
@ -1,3 +1,3 @@
|
|||
"""Configuration for pytest runner."""
|
||||
|
||||
pytest_plugins = "pytester"
|
||||
pytest_plugins = 'pytester'
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
from pytest_bdd import given
|
||||
|
||||
|
||||
@given('I have the overriden fixture')
|
||||
def overridable():
|
||||
return 'child'
|
|
@ -0,0 +1,25 @@
|
|||
"""Test givens declared in the base conftest and plugin files.
|
||||
|
||||
Check the parent givens are collected, override them locally.
|
||||
"""
|
||||
from pytest_bdd import given
|
||||
|
||||
|
||||
@given('I have locally overriden fixture')
|
||||
def overridable():
|
||||
return 'local'
|
||||
|
||||
|
||||
@given('I have locally overriden parent fixture')
|
||||
def parent():
|
||||
return 'local'
|
||||
|
||||
|
||||
def test_override(overridable):
|
||||
"""Test locally overriden fixture."""
|
||||
assert overridable == 'local'
|
||||
|
||||
|
||||
def test_parent(parent):
|
||||
"""Test locally overriden parent fixture."""
|
||||
assert parent == 'local'
|
|
@ -0,0 +1,14 @@
|
|||
"""Test givens declared in the base conftest and plugin files.
|
||||
|
||||
Check the parent givens are collected and overriden in the local conftest.
|
||||
"""
|
||||
|
||||
|
||||
def test_parent(parent):
|
||||
"""Test parent given is collected."""
|
||||
assert parent == 'parent'
|
||||
|
||||
|
||||
def test_override(overridable):
|
||||
"""Test the child conftest overriding the fixture."""
|
||||
assert overridable == 'child'
|
|
@ -0,0 +1,11 @@
|
|||
from pytest_bdd import given
|
||||
|
||||
|
||||
@given('I have parent fixture')
|
||||
def parent():
|
||||
return 'parent'
|
||||
|
||||
|
||||
@given('I have overridable parent fixture')
|
||||
def overridable():
|
||||
return 'parent'
|
Loading…
Reference in New Issue