changes
- collection will now always run during the `pytest_collection` stage. this probably significantly improves compatibility with other pytest plugins (https://github.com/DetachHead/pytest-robotframework/pull/218)
- the deprecated `listener` and `pre_rebot_modifier` decorators have been removed (https://github.com/DetachHead/pytest-robotframework/pull/218)
**Full Changelog**: https://github.com/DetachHead/pytest-robotframework/compare/3.2.1...4.0.0
⚠️ breaking changes / migration guide
the deprecated `listener` and `pre_rebot_modifier` decorators have been removed.
listeners
before
py
conftest.py
listener
def Foo(ListenerV3):
...
after
py
conftest.py
from pytest_robotframework import RobotOptions
def Foo(ListenerV3):
...
def pytest_robot_modify_options(options: RobotOptions):
options["listener"].append(Foo())
pre-run modifiers
before
py
conftest.py
pre_run_modifier
def Foo(SuiteVisitor):
...
after
py
conftest.py
from pytest_robotframework import RobotOptions
def Foo(SuiteVisitor):
...
def pytest_robot_modify_options(options: RobotOptions):
options["prerunmodifier"].append(Foo())
why?
using the `pytest_robot_modify_options` may be more boilerplatey, but there are several benefits to this approach:
- it gives you far more control over when listeners/pre-run modifiers are enabled, and allows you to instantiate them yourself with different arguments
- it does not rely on global state to "register" them to be enabled when robotframework runs, which was flaky when running with xdist