Register custom test category markers.
Since around pytest 3.6 it's been possible to register custom
markers, and since version 4.5.0 pytest warns about any which
are not registered. Register a list of such markers, extracted
from those warnings, so they don't clutter the test output.
diff --git a/tests/conftest.py b/tests/conftest.py
index 04ac784..107659b 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -16,12 +16,54 @@
from jinja2 import Environment
-def pytest_ignore_collect(path, config):
+def pytest_ignore_collect(path):
if 'async' in path.basename and not have_async_gen:
return True
return False
+def pytest_configure(config):
+ '''Register custom marks for test categories.'''
+ custom_markers = [
+ 'api',
+ 'byte_code_cache',
+ 'core_tags',
+ 'debug',
+ 'escapeUrlizeTarget',
+ 'ext',
+ 'extended',
+ 'filter',
+ 'for_loop',
+ 'helpers',
+ 'if_condition',
+ 'imports',
+ 'includes',
+ 'inheritance',
+ 'lexer',
+ 'lexnparse',
+ 'loaders',
+ 'lowlevel',
+ 'lrucache',
+ 'lstripblocks',
+ 'macros',
+ 'meta',
+ 'moduleloader',
+ 'parser',
+ 'regression',
+ 'sandbox',
+ 'set',
+ 'streaming',
+ 'syntax',
+ 'test_tests',
+ 'tokenstream',
+ 'undefined',
+ 'utils',
+ 'with_',
+ ]
+ for mark in custom_markers:
+ config.addinivalue_line('markers', mark + ': test category')
+
+
@pytest.fixture
def env():
'''returns a new environment.