Skip to content
Myr

Register custom test category markers.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by Ralph Giles · committed by David Lord · parent 94cecd4 · Browse files · 1 file+43 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+43 added−1 removed

  • tests:+43 added−1 removed

1 file+43 added−1 removed

modified:tests/conftest.py+43 added-1 removed
14 unmodified lines
15from jinja2.utils import have_async_gen16from jinja2 import Environment171819def pytest_ignore_collect(path, config):19def pytest_ignore_collect(path):20 if 'async' in path.basename and not have_async_gen:21 return True22 return False232425def pytest_configure(config):26 '''Register custom marks for test categories.'''27 custom_markers = [28 'api',29 'byte_code_cache',30 'core_tags',31 'debug',32 'escapeUrlizeTarget',33 'ext',34 'extended',35 'filter',36 'for_loop',37 'helpers',38 'if_condition',39 'imports',40 'includes',41 'inheritance',42 'lexer',43 'lexnparse',44 'loaders',45 'lowlevel',46 'lrucache',47 'lstripblocks',48 'macros',49 'meta',50 'moduleloader',51 'parser',52 'regression',53 'sandbox',54 'set',55 'streaming',56 'syntax',57 'test_tests',58 'tokenstream',59 'undefined',60 'utils',61 'with_',62 ]63 for mark in custom_markers:64 config.addinivalue_line('markers', mark + ': test category')656667@pytest.fixture68def env():69 '''returns a new environment.70 '''
49 unmodified lines