summaryrefslogtreecommitdiffstats
path: root/tests/snippets/conftest.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
commit1f403ad2197fc7442409f434ee574f3e6b46fb73 (patch)
tree0299c6dd11d5edfa918a29b6456bc1875f1d288c /tests/snippets/conftest.py
parentInitial commit. (diff)
downloadpygments-upstream.tar.xz
pygments-upstream.zip
Adding upstream version 2.14.0+dfsg.upstream/2.14.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/snippets/conftest.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/snippets/conftest.py b/tests/snippets/conftest.py
new file mode 100644
index 0000000..02e6255
--- /dev/null
+++ b/tests/snippets/conftest.py
@@ -0,0 +1,32 @@
+"""
+ 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-2022 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='')