Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7a51bb0
add possibility to run async steps
amadeuszhercog-silvair Dec 31, 2019
beb111e
move fixtures to separate file
Xaaq Jan 25, 2020
0741b16
rename feature for launching app in task
Xaaq Jan 29, 2020
ab6d3b6
use unused_tcp_port fixture from pytest-asyncio
Xaaq Jan 29, 2020
31d9a48
create scenarios for checking if async steps work
Xaaq Jan 29, 2020
da10429
add TODO
Xaaq Jan 29, 2020
4262c40
add pooling instead of wait step
Xaaq Feb 2, 2020
5a2f218
add fixture with app tick rate
Xaaq Feb 2, 2020
9ef9ec5
move sleeps in dummy app below rest of the body
Xaaq Feb 2, 2020
9588bf4
add "test_" to feature files names
Xaaq Feb 2, 2020
47e3947
cleanup starting flask test server
Xaaq Feb 2, 2020
1403c46
rename and decrease app_tick_rate to app_tick_interval
Xaaq Feb 2, 2020
50ad173
add tests for given to be a fixture
Xaaq Feb 2, 2020
60085b2
extract code for running coroutines to function
Xaaq Feb 2, 2020
5362eef
cleanup
Xaaq Feb 3, 2020
e4020ae
add tests for checking if async scenario is launched
Xaaq Feb 3, 2020
4e9bef5
add test requirements
Xaaq Mar 9, 2020
6fc9340
delete test
Xaaq Mar 9, 2020
aafa8d4
add support for python 3.6 and 3.5
Xaaq Mar 9, 2020
cd7562e
add test back and skip it if pytest < 5.1.0
Xaaq Mar 9, 2020
1ab24b8
add 'using asyncio' section to docs
Xaaq Mar 11, 2020
4eaa6a3
add async_generator to setup.py
amadeuszhercog-silvair Mar 12, 2020
37d9168
make async hooks be executed
Xaaq Feb 2, 2020
2a9e575
add tests for async hooks
Xaaq Feb 3, 2020
c95304c
remove unused hooks from conftest
Xaaq Mar 9, 2020
2054d23
add 'async hooks' section to readme
Xaaq Mar 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests for given to be a fixture
  • Loading branch information
Xaaq committed Feb 2, 2020
commit 50ad17331b25ad1c888b7da67f969f5427d22654
9 changes: 9 additions & 0 deletions tests/asyncio/test_async_given_returns_value.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: Async given is a fixture and its value is properly returned

Scenario: Async given shadows fixture
Given i have given that shadows fixture with value of 42
Then shadowed fixture value should be equal to 42

Scenario: Async given is a fixture
Given i have given that is a fixture with value of 42
Then value of given as a fixture should be equal to 42
30 changes: 30 additions & 0 deletions tests/asyncio/test_async_given_returns_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pytest

from pytest_bdd import given, parsers, then, scenarios

scenarios("test_async_given_returns_value.feature")


@pytest.fixture
def my_value():
return 0


@given(parsers.parse("i have given that shadows fixture with value of {value:d}"), target_fixture="my_value")
async def i_have_given_that_shadows_fixture_with_value_of(value):
return value


@then(parsers.parse("shadowed fixture value should be equal to {value:d}"))
async def my_fixture_value_should_be_equal_to(value, my_value):
assert value == my_value


@given(parsers.parse("i have given that is a fixture with value of {value:d}"))
async def i_have_given_that_is_a_fixture_with_value_of(value):
return value


@then(parsers.parse("value of given as a fixture should be equal to {value:d}"))
async def value_of_given_as_a_fixture_should_be_equal_to(value, i_have_given_that_is_a_fixture_with_value_of):
assert value == i_have_given_that_is_a_fixture_with_value_of