Skip to content

Instantly share code, notes, and snippets.

@ksindi
Forked from billyshambrook/conftest.py
Created April 28, 2017 02:49
Show Gist options
  • Save ksindi/29c5456de16c6bb2e5ee9bb1202307b8 to your computer and use it in GitHub Desktop.
Save ksindi/29c5456de16c6bb2e5ee9bb1202307b8 to your computer and use it in GitHub Desktop.
Categorise integration tests using PyTest.
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:
if not item.config.getoption("--integration"):
pytest.skip("need --integration option to run")
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