This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/tests/snippets/conftest.py
2023-03-29 21:11:12 +02:00

32 lines
923 B
Python

"""
Generated lexer tests
~~~~~~~~~~~~~~~~~~~~~
Checks that lexers output the expected tokens for each sample
under lexers/*/test_*.txt.
After making a change, rather than updating the samples manually,
run `pytest --update-goldens tests/lexers`.
To add a new sample, create a new file matching this pattern.
The directory must match the alias of the lexer to be used.
Populate only the input, then just `--update-goldens`.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import pathlib
import pytest
from tests.conftest import LexerInlineTestItem
def pytest_collect_file(parent, path):
if path.ext == '.txt':
return LexerTestFile.from_parent(parent, path=pathlib.Path(path))
class LexerTestFile(pytest.File):
def collect(self):
yield LexerInlineTestItem.from_parent(self, name='')