Skip to content

Ordering problem between slash.fixture and slash.parameters.iterate decorator #991

@ayalash

Description

@ayalash

There is importance for the order of slash.fixutre (in case it is yield fixture) and slash.parameters.iterate decorators:

import slash


@slash.fixture
@slash.parameters.iterate(my_param=['a', 'b'])
def fixture_1(my_param):
    yield my_param

@slash.parameters.iterate(my_param=['a', 'b'])
@slash.fixture
def fixture_2(my_param):
    yield my_param

def test_a(fixture_1, fixture_2):
    slash.logger.info(f"fixture_1 value: {fixture_1}")
    slash.logger.info(f"fixture_2 value: {fixture_2}")
slash run -v ~/Documents/tmp/test_me.py
4 tests collected   
[2019-11-07 11:24:13] #1: /home/ayalas/Documents/tmp/test_me.py:test_a(fixture_1.my_param=a,fixture_2.my_param=a)
[2019-11-07 11:24:13] fixture_1 value: <generator object fixture_1 at 0x7efd59951048>
[2019-11-07 11:24:13] fixture_2 value: a
[2019-11-07 11:24:13] #2: /home/ayalas/Documents/tmp/test_me.py:test_a(fixture_1.my_param=a,fixture_2.my_param=b)
[2019-11-07 11:24:13] fixture_1 value: <generator object fixture_1 at 0x7efd597b7b48>
[2019-11-07 11:24:13] fixture_2 value: b
[2019-11-07 11:24:13] #3: /home/ayalas/Documents/tmp/test_me.py:test_a(fixture_1.my_param=b,fixture_2.my_param=a)
[2019-11-07 11:24:13] fixture_1 value: <generator object fixture_1 at 0x7efd597b7d00>
[2019-11-07 11:24:13] fixture_2 value: a
[2019-11-07 11:24:13] #4: /home/ayalas/Documents/tmp/test_me.py:test_a(fixture_1.my_param=b,fixture_2.my_param=b)
[2019-11-07 11:24:13] fixture_1 value: <generator object fixture_1 at 0x7efd59974ba0>
[2019-11-07 11:24:13] fixture_2 value: b
============================================================ Session ended. 4 successful, 0 skipped, 0 failed, 0 erroneous. Total duration: 00:00:00 =============================================================

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions