Skip to content

Commit

Permalink
_dependee_fixture_argnames: return tuple
Browse files Browse the repository at this point in the history
Note: black cannot parse `return *active_fixture_argnames,
*self.argnames` yet (fixed in master, psf/black#1121).

Tested manually using:
```python
@pytest.fixture(scope="session")
def xdist_suffix(request):
    print("\nxdist_suffix")
    suffixes.append("xdist")

@pytest.fixture(scope="session")
def parallel_suffix(tox_suffix, xdist_suffix):
    pass

def test_suffix(parallel_suffix):
    assert suffixes == ["tox", "xdist"]
```

When using a set there the order is not deterministic, i.e. the test is
flaky.
  • Loading branch information
blueyed committed Jan 23, 2020
1 parent 1bcb0c0 commit bab4dd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ def _dependee_fixture_argnames(self, request):

stack_slice_index = min([current_fix_index, *parent_fixture_indexes])
active_fixture_argnames = all_fix_names[:stack_slice_index]
return {*active_fixture_argnames, *self.argnames}
return tuple(active_fixture_argnames) + self.argnames

def cache_key(self, request):
return request.param_index if not hasattr(request, "param") else request.param
Expand Down

0 comments on commit bab4dd0

Please sign in to comment.