arjuna.tpi.engine.resource module¶
Arjuna Test Resources
The test resources markup provided by Arjuna includes easy-to-use decorators which wrap pytest.fixture decorator.
Note
For using any of the decorators in this module, the resource function must have the signature as f(request) with request as the first argument.
- arjuna.tpi.engine.resource.for_group(func: Callable = None, *, drive_with: DataSource = None, default: bool = False) Callable ¶
Decorator for session level test resource.
Wraps pytest.fixture to create a fixture with scope=session and provides an Arjuna’s decorated version of the function that is marked with for_group decorator.
- Parameters
func – A Function with signature f(request). The name request is mandatory and enforced.
- Keyword Arguments
drive_with –
(Optional) Used for data driven testing. Argument can be Arjuna Data Source.
@for_group(drive_with=<DS>) def fix(request, data): pass
default – Should it be auto-applied?
- arjuna.tpi.engine.resource.for_module(func: Callable = None, *, drive_with: DataSource = None, default: bool = False) Callable ¶
Decorator for module level test fixture/resource.
Wraps pytest.fixture to create a fixture with scope=module and provides an Arjuna’s decorated version of the function that is marked with for_module decorator.
- Parameters
func – A Function with signature f(request). The name request is mandatory and enforced.
- Keyword Arguments
drive_with –
(Optional) Used for data driven testing. Argument can be Arjuna Data Source.
@for_module(drive_with=<DS>) def fix(request, data): pass
default – Should it be auto-applied?
- arjuna.tpi.engine.resource.for_test(func: Callable = None, *, drive_with: DataSource = None, default: bool = False) Callable ¶
Decorator for test function level test fixture/resource.
Wraps pytest.fixture to create a fixture with scope=function and provides an Arjuna’s decorated version of the function that is marked with for_test decorator.
- Parameters
func – A Function with signature f(request). The name request is mandatory and enforced.
- Keyword Arguments
drive_with –
(Optional) Used for data driven testing. Argument can be Arjuna Data Source.
@for_test(drive_with=<DS>) def fix(request): pass
default – Should it be auto-applied?
- arjuna.tpi.engine.resource.group(request)¶
- arjuna.tpi.engine.resource.test_resources(request)¶