As of now, my only solution is to create a device that returns a dictionary of devices.
import pytest import my_package @pytest.fixture def dir1_fixture(): return '/dir1' @pytest.fixture def dir2_fixture(): return '/dir2' @pytest.fixture def dir_fixtures( dir1_fixture, dir2_fixture ): return { 'dir1_fixture': dir1_fixture, 'dir2_fixture': dir2_fixture } @pytest.mark.parametrize('fixture_name, expected', [('dir1_fixture', 'expected1'), ('dir2_fixture', 'expected2')] def test_directory_command(dir_fixtures, fixture_name, expected): dirname = dir_fixtures[fixture_name] result = my_package.directory_command(dirname) assert result == expected
Not the best, as it does not use the solution built into pytest, but it works for me.
source share