
import behave
import pytest

@pytest.fixture(autouse=True)
def _annotate_environment(request):
    """Add project-specific information to test-run environment:

    * behave.version

    NOTE: autouse: Fixture is automatically used when test-module is imported.
    """
    # -- USEFULL FOR: pytest --html=report.html ...
    behave_version = behave.__version__
    request.config._environment.append(("behave", behave_version))



import behave
import pytest

@pytest.fixture(autouse=True)
def _annotate_environment(request):
    """Add project-specific information to test-run environment:

    * behave.version

    NOTE: autouse: Fixture is automatically used when test-module is imported.
    """
    # -- USEFULL FOR: pytest --html=report.html ...
    environment = getattr(request.config, "_environment", None)
    if environment:
        # -- PROVIDED-BY: pytest-html
        behave_version = behave.__version__
        environment.append(("behave", behave_version))


FIX when pytest-html is not installed.
FIX when pytest-html is not installed.

  
  import behave
  import pytest
  
  @pytest.fixture(autouse=True)
  def _annotate_environment(request):
      """Add project-specific information to test-run environment:
  
      * behave.version
  
      NOTE: autouse: Fixture is automatically used when test-module is imported.
      """
      # -- USEFULL FOR: pytest --html=report.html ...
+     environment = getattr(request.config, "_environment", None)
+     if environment:
+         # -- PROVIDED-BY: pytest-html
-     behave_version = behave.__version__
+         behave_version = behave.__version__
-     request.config._environment.append(("behave", behave_version))
+         environment.append(("behave", behave_version))
  
  
FIX when pytest-html is not installed.
## Code Before:

import behave
import pytest

@pytest.fixture(autouse=True)
def _annotate_environment(request):
    """Add project-specific information to test-run environment:

    * behave.version

    NOTE: autouse: Fixture is automatically used when test-module is imported.
    """
    # -- USEFULL FOR: pytest --html=report.html ...
    behave_version = behave.__version__
    request.config._environment.append(("behave", behave_version))


## Instruction:
FIX when pytest-html is not installed.
## Code After:

import behave
import pytest

@pytest.fixture(autouse=True)
def _annotate_environment(request):
    """Add project-specific information to test-run environment:

    * behave.version

    NOTE: autouse: Fixture is automatically used when test-module is imported.
    """
    # -- USEFULL FOR: pytest --html=report.html ...
    environment = getattr(request.config, "_environment", None)
    if environment:
        # -- PROVIDED-BY: pytest-html
        behave_version = behave.__version__
        environment.append(("behave", behave_version))

