Created
April 9, 2018 14:13
-
-
Save lodagro/ae5483215ddd2df791ace7e2d1942318 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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