Skip to content

Commit 687c7cd

Browse files
committed
test: resolve tox failures
1 parent 11c0628 commit 687c7cd

8 files changed

+23
-22
lines changed

mdformat_mkdocs/_postprocess_inline.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ def postprocess_list_wrap(
4141
):
4242
return text
4343

44-
_counter = -1
44+
counter_ = -1
4545
parent = node.parent
4646
while parent and parent.type == "paragraph":
4747
parent = parent.parent
48-
_counter += 1
49-
indent_count = max(_counter, 0)
48+
counter_ += 1
49+
indent_count = max(counter_, 0)
5050

5151
soft_break = "\x00"
5252
text = text.lstrip(soft_break).lstrip()

mdformat_mkdocs/mdit_plugins/_material_content_tabs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"""
3232

3333
from markdown_it.rules_block import StateBlock
34-
from mdformat_admon.factories import (
34+
35+
from mdformat_mkdocs._synced.admon_factories import (
3536
AdmonitionData,
3637
admon_plugin_factory,
3738
new_token,

mdformat_mkdocs/mdit_plugins/_mkdocstrings_autorefs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
from markdown_it import MarkdownIt
1919
from markdown_it.rules_block import StateBlock
2020
from markdown_it.rules_inline import StateInline
21-
from mdformat_admon.factories import new_token
21+
22+
from mdformat_mkdocs._synced.admon_factories import new_token
2223

2324
_AUTOREFS_PATTERN = re.compile(r"\[\]\(<?>?\){#(?P<anchor>[^ }]+)}")
2425
_HEADING_PATTERN = re.compile(r"(?P<markdown>^#{1,6}) (?P<content>.+)")

mdformat_mkdocs/mdit_plugins/_mkdocstrings_crossreference.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
from markdown_it import MarkdownIt
1717
from markdown_it.rules_inline import StateInline
18-
from mdformat_admon.factories import new_token
18+
19+
from mdformat_mkdocs._synced.admon_factories import new_token
1920

2021
_CROSSREFERENCE_PATTERN = re.compile(r"\[(?P<link>[^[|\]\n]+)\]\[(?P<href>[^\]\n]*)\]")
2122
MKDOCSTRINGS_CROSSREFERENCE_PREFIX = "mkdocstrings_crossreference"

mdformat_mkdocs/mdit_plugins/_python_markdown_admon.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from markdown_it.rules_block import StateBlock
88

9-
from mdformat_admon._synced.admon_factories import (
9+
from mdformat_mkdocs._synced.admon_factories import (
1010
AdmonitionData,
1111
admon_plugin_factory,
1212
new_token,

mdformat_mkdocs/plugin.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,7 @@ def render_admon_title(
157157

158158

159159
def add_extra_admon_newline(node: RenderTreeNode, context: RenderContext) -> str:
160-
"""Return admonition with additional newline after the title.
161-
162-
See: https://github.com/KyleKing/mdformat-admon/pull/22
163-
164-
"""
160+
"""Return admonition with additional newline after the title for mkdocs."""
165161
result = render_admon(node, context)
166162
if "\n" not in result:
167163
return result

pyproject.toml

+11-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ classifiers = [
1414
]
1515
dependencies = [
1616
"mdformat >= 0.7.19",
17-
"mdformat-admon >= 2.0.6",
1817
"mdformat-gfm >= 0.3.6",
1918
"mdit-py-plugins >= 0.4.1",
2019
"more-itertools >= 10.5.0",
@@ -85,7 +84,7 @@ ignore_patterns = []
8584
now = true
8685
patterns = ["*.ambr", "*.md", "*.py"]
8786
runner = "tox"
88-
runner_args = ["-e", "py312-beartype"]
87+
runner_args = ["-e", "py312-test", "--", "--exitfirst", "--failed-first", "--new-first", "-vv", "--beartype-packages=mdformat_mkdocs", "--snapshot-update"]
8988

9089
[tool.ruff]
9190
# Docs: https://github.com/charliermarsh/ruff
@@ -152,22 +151,20 @@ all = true
152151
in_place = true
153152
trailing_comma_inline_array = true
154153

154+
[tool.tomlsort.overrides."tool.pytest-watcher.*"]
155+
inline_arrays = false
156+
155157
[tool.tomlsort.overrides."tool.tox.env.*"]
156158
inline_arrays = false
157159

158160
[tool.tox]
159161
# Docs: https://tox.wiki/en/4.23.2/config.html#core
160162
basepython = ["python3.12", "python3.9"]
161-
env_list = ["py12-test", "py312-pre-commit", "py312-ruff", "py312-type", "py39-hook", "py39-test"]
163+
env_list = ["py312-pre-commit", "py312-ruff", "py312-test", "py312-type", "py39-hook", "py39-test"]
162164
isolated_build = true
163165
requires = ["tox>=4.20.0"]
164166
skip_missing_interpreters = false
165167

166-
[tool.tox.env."py12-test"]
167-
commands = [["pytest", "--cov=mdformat_mkdocs", {default = [], extend = true, replace = "posargs"}]]
168-
deps = ["--requirement=tests/requirements.txt"]
169-
description = "Optionally, specify: '--exitfirst --failed-first --new-first -vv --beartype-packages=mdformat_mkdocs'"
170-
171168
[tool.tox.env."py312-pre-commit"]
172169
commands = [["pre-commit", "run", "--all-files", {default = [], extend = true, replace = "posargs"}]]
173170
deps = "pre-commit>=4.0.1"
@@ -182,18 +179,22 @@ deps = "ruff>=0.8.3"
182179
description = "Optionally, specify: '--unsafe-fixes'"
183180
skip_install = true
184181

182+
[tool.tox.env."py312-test"]
183+
commands = [["pytest", "--cov=mdformat_mkdocs", {default = [], extend = true, replace = "posargs"}]]
184+
description = "Optionally, specify: '--exitfirst --failed-first --new-first -vv --beartype-packages=mdformat_mkdocs --snapshot-update"
185+
extras = ["test"]
186+
185187
[tool.tox.env."py312-type"]
186188
commands = [["mypy", "./mdformat_mkdocs", {default = [], extend = true, replace = "posargs"}]]
187189
deps = ["mypy>=1.13.0"]
188190

189191
[tool.tox.env."py39-hook"]
190192
commands = [["pre-commit", "run", "--config=.pre-commit-test.yaml", "--all-files", {default = ["--show-diff-on-failure", "--verbose"], extend = true, replace = "posargs"}]]
191193
deps = "pre-commit>=4.0.1"
192-
skip_install = true
193194

194195
[tool.tox.env."py39-test"]
195196
commands = [["pytest", "--cov=mdformat_mkdocs"]]
196-
deps = ["--requirement=tests/requirements.txt"]
197+
extras = ["test"]
197198

198199
[tool.tox.env_run_base]
199200
# Validates that commands are set

tests/format/fixtures/text.md

+1
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,7 @@ More complex example to validate formatting when nested
14021402
===+ "Third"
14031403
14041404
- List Item
1405+
14051406
- Another Item
14061407
14071408
=== "Fourth"

0 commit comments

Comments
 (0)