pytest-codeblock 0.5.7__tar.gz → 0.5.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_codeblock-0.5.7/src/pytest_codeblock.egg-info → pytest_codeblock-0.5.8}/PKG-INFO +2 -1
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/pyproject.toml +8 -1
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/__init__.py +1 -1
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/md.py +15 -2
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/rst.py +15 -2
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8/src/pytest_codeblock.egg-info}/PKG-INFO +2 -1
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/requires.txt +1 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/LICENSE +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/README.rst +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/setup.cfg +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/collector.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/config.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/constants.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/helpers.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/pytestrun.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/__init__.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/test_customisation.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/test_integration.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/test_nameless_codeblocks.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/test_pytest_codeblock.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/test_pytestrun_marker.py +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/SOURCES.txt +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/dependency_links.txt +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/entry_points.txt +0 -0
- {pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-codeblock
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.8
|
|
4
4
|
Summary: Pytest plugin to collect and test code blocks in reStructuredText and Markdown files.
|
|
5
5
|
Author-email: Artur Barseghyan <artur.barseghyan@gmail.com>
|
|
6
6
|
Maintainer-email: Artur Barseghyan <artur.barseghyan@gmail.com>
|
|
@@ -48,6 +48,7 @@ Requires-Dist: pytest; extra == "test"
|
|
|
48
48
|
Requires-Dist: pytest-cov; extra == "test"
|
|
49
49
|
Requires-Dist: pytest-django; extra == "test"
|
|
50
50
|
Requires-Dist: respx; extra == "test"
|
|
51
|
+
Requires-Dist: langchain-tests; extra == "test"
|
|
51
52
|
Provides-Extra: docs
|
|
52
53
|
Requires-Dist: sphinx; extra == "docs"
|
|
53
54
|
Requires-Dist: sphinx-autobuild; extra == "docs"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name = "pytest-codeblock"
|
|
3
3
|
description = "Pytest plugin to collect and test code blocks in reStructuredText and Markdown files."
|
|
4
4
|
readme = "README.rst"
|
|
5
|
-
version = "0.5.
|
|
5
|
+
version = "0.5.8"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"pytest",
|
|
@@ -66,6 +66,7 @@ test = [
|
|
|
66
66
|
"pytest-cov",
|
|
67
67
|
"pytest-django",
|
|
68
68
|
"respx",
|
|
69
|
+
"langchain-tests", # Module-scoped fixtures for testing scope resolution
|
|
69
70
|
]
|
|
70
71
|
docs = [
|
|
71
72
|
"sphinx",
|
|
@@ -253,6 +254,7 @@ ignore = [
|
|
|
253
254
|
".idea",
|
|
254
255
|
".vscode",
|
|
255
256
|
".DS_Store",
|
|
257
|
+
".claude",
|
|
256
258
|
"Thumbs.db",
|
|
257
259
|
".ruff_cache",
|
|
258
260
|
".coverage.*",
|
|
@@ -267,6 +269,7 @@ ignore = [
|
|
|
267
269
|
"docs/_implement_pytest_hooks.rst",
|
|
268
270
|
"docs/changelog.rst",
|
|
269
271
|
"docs/code_of_conduct.rst",
|
|
272
|
+
"docs/contributor_guidelines.rst",
|
|
270
273
|
"docs/documentation.rst",
|
|
271
274
|
"docs/full-llms.rst",
|
|
272
275
|
"docs/index.rst",
|
|
@@ -277,6 +280,7 @@ ignore = [
|
|
|
277
280
|
"docs/source_tree_full.rst",
|
|
278
281
|
"docs/make.bat",
|
|
279
282
|
"docs/Makefile",
|
|
283
|
+
"src/pytest_codeblock/tests/pytest_codeblock_*.py",
|
|
280
284
|
]
|
|
281
285
|
order = [
|
|
282
286
|
"README.rst",
|
|
@@ -320,6 +324,7 @@ ignore = [
|
|
|
320
324
|
".idea",
|
|
321
325
|
".vscode",
|
|
322
326
|
".DS_Store",
|
|
327
|
+
".claude",
|
|
323
328
|
"Thumbs.db",
|
|
324
329
|
".ruff_cache",
|
|
325
330
|
".coverage.*",
|
|
@@ -334,6 +339,7 @@ ignore = [
|
|
|
334
339
|
"docs/_implement_pytest_hooks.rst",
|
|
335
340
|
"docs/changelog.rst",
|
|
336
341
|
"docs/code_of_conduct.rst",
|
|
342
|
+
"docs/contributor_guidelines.rst",
|
|
337
343
|
"docs/documentation.rst",
|
|
338
344
|
"docs/full-llms.rst",
|
|
339
345
|
"docs/index.rst",
|
|
@@ -345,4 +351,5 @@ ignore = [
|
|
|
345
351
|
"docs/make.bat",
|
|
346
352
|
"docs/Makefile",
|
|
347
353
|
"examples",
|
|
354
|
+
"src/pytest_codeblock/tests/pytest_codeblock_*.py",
|
|
348
355
|
]
|
|
@@ -6,7 +6,7 @@ from .md import MarkdownFile
|
|
|
6
6
|
from .rst import RSTFile
|
|
7
7
|
|
|
8
8
|
__title__ = "pytest-codeblock"
|
|
9
|
-
__version__ = "0.5.
|
|
9
|
+
__version__ = "0.5.8"
|
|
10
10
|
__author__ = "Artur Barseghyan <artur.barseghyan@gmail.com>"
|
|
11
11
|
__copyright__ = "2025-2026 Artur Barseghyan"
|
|
12
12
|
__license__ = "MIT"
|
|
@@ -3,6 +3,8 @@ import inspect
|
|
|
3
3
|
import re
|
|
4
4
|
import textwrap
|
|
5
5
|
import traceback
|
|
6
|
+
import types
|
|
7
|
+
from collections.abc import Generator
|
|
6
8
|
from typing import Optional
|
|
7
9
|
|
|
8
10
|
import pytest
|
|
@@ -157,12 +159,23 @@ def parse_markdown(text: str) -> list[CodeSnippet]:
|
|
|
157
159
|
return snippets
|
|
158
160
|
|
|
159
161
|
|
|
160
|
-
class MarkdownFile(pytest.
|
|
162
|
+
class MarkdownFile(pytest.Module):
|
|
161
163
|
"""
|
|
162
164
|
Collector for Markdown files, extracting only `test_`-prefixed code
|
|
163
165
|
snippets.
|
|
164
166
|
"""
|
|
165
|
-
|
|
167
|
+
|
|
168
|
+
def _getobj(self) -> types.ModuleType:
|
|
169
|
+
m = types.ModuleType(self.path.stem)
|
|
170
|
+
m.__file__ = str(self.path)
|
|
171
|
+
m.__test__ = False # prevent PyCollector from auto-collecting
|
|
172
|
+
return m
|
|
173
|
+
|
|
174
|
+
def collect(self) -> Generator[pytest.Function, None, None]:
|
|
175
|
+
# Register with fixture manager so module-scoped fixtures can find
|
|
176
|
+
# a pytest.Module parent node (fixes scope resolution when plugins
|
|
177
|
+
# like pytest-recording/langchain-tests define module-scoped fixtures).
|
|
178
|
+
self.session._fixturemanager.parsefactories(self)
|
|
166
179
|
text = self.path.read_text(encoding="utf-8")
|
|
167
180
|
raw = parse_markdown(text)
|
|
168
181
|
config = get_config()
|
|
@@ -3,6 +3,8 @@ import inspect
|
|
|
3
3
|
import re
|
|
4
4
|
import textwrap
|
|
5
5
|
import traceback
|
|
6
|
+
import types
|
|
7
|
+
from collections.abc import Generator
|
|
6
8
|
from pathlib import Path
|
|
7
9
|
from typing import Optional, Union
|
|
8
10
|
|
|
@@ -286,9 +288,20 @@ def parse_rst(text: str, base_dir: Path) -> list[CodeSnippet]:
|
|
|
286
288
|
return snippets
|
|
287
289
|
|
|
288
290
|
|
|
289
|
-
class RSTFile(pytest.
|
|
291
|
+
class RSTFile(pytest.Module):
|
|
290
292
|
"""Collect RST code-block tests as real test functions."""
|
|
291
|
-
|
|
293
|
+
|
|
294
|
+
def _getobj(self) -> types.ModuleType:
|
|
295
|
+
m = types.ModuleType(self.path.stem)
|
|
296
|
+
m.__file__ = str(self.path)
|
|
297
|
+
m.__test__ = False # prevent PyCollector from auto-collecting
|
|
298
|
+
return m
|
|
299
|
+
|
|
300
|
+
def collect(self) -> Generator[pytest.Function, None, None]:
|
|
301
|
+
# Register this node with the fixture manager so that module-scoped
|
|
302
|
+
# fixtures (e.g. vcr_cassette_dir from pytest-recording/langchain-tests)
|
|
303
|
+
# can resolve their scope by walking up to a pytest.Module parent.
|
|
304
|
+
self.session._fixturemanager.parsefactories(self)
|
|
292
305
|
text = self.path.read_text(encoding="utf-8")
|
|
293
306
|
raw = parse_rst(text, self.path)
|
|
294
307
|
config = get_config()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-codeblock
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.8
|
|
4
4
|
Summary: Pytest plugin to collect and test code blocks in reStructuredText and Markdown files.
|
|
5
5
|
Author-email: Artur Barseghyan <artur.barseghyan@gmail.com>
|
|
6
6
|
Maintainer-email: Artur Barseghyan <artur.barseghyan@gmail.com>
|
|
@@ -48,6 +48,7 @@ Requires-Dist: pytest; extra == "test"
|
|
|
48
48
|
Requires-Dist: pytest-cov; extra == "test"
|
|
49
49
|
Requires-Dist: pytest-django; extra == "test"
|
|
50
50
|
Requires-Dist: respx; extra == "test"
|
|
51
|
+
Requires-Dist: langchain-tests; extra == "test"
|
|
51
52
|
Provides-Extra: docs
|
|
52
53
|
Requires-Dist: sphinx; extra == "docs"
|
|
53
54
|
Requires-Dist: sphinx-autobuild; extra == "docs"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/test_customisation.py
RENAMED
|
File without changes
|
{pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock/tests/test_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{pytest_codeblock-0.5.7 → pytest_codeblock-0.5.8}/src/pytest_codeblock.egg-info/top_level.txt
RENAMED
|
File without changes
|