| 1 |
# -*- coding: UTF-8 -*- |
| 2 |
""" |
| 3 |
Configure pytest environment. |
| 4 |
Add project-specific information. |
| 5 |
|
| 6 |
.. seealso:: |
| 7 |
* https://github.com/pytest-dev/pytest-html |
| 8 |
""" |
| 9 |
|
| 10 |
import behave |
| 11 |
import pytest |
| 12 |
|
| 13 |
@pytest.fixture(autouse=True) |
| 14 |
def _annotate_environment(request): |
| 15 |
"""Add project-specific information to test-run environment: |
| 16 |
|
| 17 |
* behave.version |
| 18 |
|
| 19 |
NOTE: autouse: Fixture is automatically used when test-module is imported. |
| 20 |
""" |
| 21 |
# -- USEFULL FOR: pytest --html=report.html ... |
| 22 |
environment = getattr(request.config, "_environment", None) |
| 23 |
if environment: |
| 24 |
# -- PROVIDED-BY: pytest-html |
| 25 |
behave_version = behave.__version__ |
| 26 |
environment.append(("behave", behave_version)) |
| 27 |
|