4.0.0
changes
- collection will now always run during the
pytest_collection
stage. this probably significantly improves compatibility with other pytest plugins (#218) - the deprecated
listener
andpre_rebot_modifier
decorators have been removed (#218)
Full Changelog: 3.2.1...4.0.0
⚠️ breaking changes / migration guide
the deprecated listener
and pre_rebot_modifier
decorators have been removed.
listeners
before
# conftest.py
@listener
def Foo(ListenerV3):
...
after
# 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
# conftest.py
@pre_run_modifier
def Foo(SuiteVisitor):
...
after
# 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