Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
@use.with_python.version=3.4 | ||
@use.with_python.version=3.5 | ||
@use.with_python.version=3.6 | ||
@use.with_python.version=3.7 | ||
@use.with_python.version=3.8 | ||
Feature: | ||
Scenario: | ||
Given an async-step waits 0.3 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...sync_step/features/steps/async_steps34.py → ...ync_step/features/steps/_async_steps34.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...sync_step/features/steps/async_steps35.py → ...ync_step/features/steps/_async_steps35.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# -- REQUIRES: Python >= 3.5 | ||
|
||
from behave import step | ||
from behave.api.async_step import async_run_until_complete | ||
import asyncio | ||
|
||
@step('an async-step waits {duration:f} seconds') | ||
@async_run_until_complete | ||
async def step_async_step_waits_seconds_py35(context, duration): | ||
"""Simple example of a coroutine as async-step (in Python 3.5)""" | ||
"""Simple example of a coroutine as async-step (in Python 3.5 or newer)""" | ||
await asyncio.sleep(duration) |
29 changes: 23 additions & 6 deletions
29
examples/async_step/features/steps/async_dispatch_steps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: UTF-8 -*- | ||
# REQUIRES: Python >= 3.4/3.5 | ||
"""Python import-barrier for python2 or python < 3.4.""" | ||
|
||
from __future__ import absolute_import | ||
import sys | ||
|
||
python_version = "%s.%s" % sys.version_info[:2] | ||
if python_version >= "3.5": | ||
import _async_steps35 | ||
elif python_version == "3.4": | ||
import _async_steps34 |