mirror of https://github.com/Shizmob/pydle.git
tests: Add real life test marker.
This commit is contained in:
parent
d6e83c0b0b
commit
0ba167754a
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,9 +7,19 @@ def pytest_addoption(parser):
|
||||||
parser.addoption('--skip-meta', action='store_true', help='skip test suite-testing tests')
|
parser.addoption('--skip-meta', action='store_true', help='skip test suite-testing tests')
|
||||||
# Add option to skip slow tests.
|
# Add option to skip slow tests.
|
||||||
parser.addoption('--skip-slow', action='store_true', help='skip slow tests')
|
parser.addoption('--skip-slow', action='store_true', help='skip slow tests')
|
||||||
|
# Add option to skip real life tests.
|
||||||
|
parser.addoption('--skip-real', action='store_true', help='skip real life tests')
|
||||||
|
|
||||||
|
|
||||||
def pytest_runtest_setup(item):
|
def pytest_runtest_setup(item):
|
||||||
if 'meta' in item.keywords and item.config.getoption('--skip-meta'):
|
if 'meta' in item.keywords and item.config.getoption('--skip-meta'):
|
||||||
pytest.skip('skipping meta test (--skip-meta given)')
|
pytest.skip('skipping meta test (--skip-meta given)')
|
||||||
if 'slow' in item.keywords and item.config.getoption('--skip-slow'):
|
if 'slow' in item.keywords and item.config.getoption('--skip-slow'):
|
||||||
pytest.skip('skipping slow test (--skip-slow given)')
|
pytest.skip('skipping slow test (--skip-slow given)')
|
||||||
|
|
||||||
|
if 'real' in item.keywords:
|
||||||
|
if item.config.getoption('--skip-real'):
|
||||||
|
pytest.skip('skipping real life test (--skip-real given)')
|
||||||
|
if (not os.getenv('PYDLE_TESTS_REAL_HOST') or
|
||||||
|
not os.getenv('PYDLE_TESTS_REAL_PORT')):
|
||||||
|
pytest.skip('skipping real life test (no real server given)')
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -14,3 +14,4 @@ commands =
|
||||||
markers =
|
markers =
|
||||||
slow: may take several seconds or more to complete.
|
slow: may take several seconds or more to complete.
|
||||||
meta: tests the test suite itself.
|
meta: tests the test suite itself.
|
||||||
|
real: tests pydle against a real server. Requires PYDLE_TESTS_REAL_HOST and PYDLE_TESTS_REAL_PORT environment variables.
|
||||||
|
|
Loading…
Reference in New Issue