Last active
March 19, 2018 17:26
-
-
Save billyshambrook/264624b039fb3caa9278 to your computer and use it in GitHub Desktop.
Categorise integration tests using PyTest.
This file contains hidden or 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 | |
def pytest_addoption(parser): | |
parser.addoption("--integration", action="store_true", help="run integration tests") | |
def pytest_runtest_setup(item): | |
if 'integration' in item.keywords: | |
item.config.getoption("--integration", skip=True) |
This file contains hidden or 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 | |
def test_unit_test(): | |
assert True | |
@pytest.mark.integration | |
def test_integration_test(): | |
assert True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is what I ended up with, the logic could be very different depending on the use case: