Skip to content

Instantly share code, notes, and snippets.

@lodagro
Created April 9, 2018 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lodagro/ae5483215ddd2df791ace7e2d1942318 to your computer and use it in GitHub Desktop.
Save lodagro/ae5483215ddd2df791ace7e2d1942318 to your computer and use it in GitHub Desktop.
import pytest
@pytest.fixture
def robot(request):
fw = request.param
print("loading firmware %r" % fw)
return {'name': 'r2d2', 'firmware': fw}
def pytest_generate_tests(metafunc):
if 'robot' in metafunc.fixturenames:
firmware_versions = ['fw%d' % i for i in range(5)]
metafunc.parametrize("robot", firmware_versions, indirect=True)
def pytest_configure(config):
config.addinivalue_line("markers",
"skip_fw(fw): skip a given firmware version")
def pytest_collection_modifyitems(session, config, items):
print('hello from pytest_collection_modifyitems')
@pytest.mark.skip_fw('fw2')
def test_one(robot):
pass
@pytest.mark.skip_fw('fw2')
@pytest.mark.skip_fw('fw4')
def test_two(robot):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment