Skip to content

Commit

Permalink
ci: fix dependency installation
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKing committed Dec 15, 2024
1 parent db53190 commit 1aeba13
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
- id: trailing-whitespace
exclude: __snapshots__/.*\.ambr
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.19
rev: 0.7.18
hooks:
- id: mdformat
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Executable Books
Copyright (c) 2024 Kyle King

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion mdformat_admon/plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Auto-loaded plugin for mdformat."""
"""Public Extension."""

from __future__ import annotations

Expand Down
13 changes: 10 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ requires-python = ">=3.9.0"
[project.entry-points."mdformat.parser_extension"]
admon = "mdformat_admon"

[project.optional-dependencies]
test = [
"pytest >= 8.3.4",
"pytest-beartype >= 0.1.1",
"pytest-cov >= 6.0.0",
]

[project.urls]
"Bug Tracker" = "https://github.com/kyleking/mdformat-admon/issues"
"Changelog" = "https://github.com/kyleking/mdformat-admon/releases"
Expand Down Expand Up @@ -131,17 +138,17 @@ trailing_comma_inline_array = true
inline_arrays = false

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

[tool.tox.env."py12-test"]
commands = [["pytest", "--cov=mdformat_admon", {default = [], extend = true, replace = "posargs"}]]
deps = ["--requirement=tests/requirements.txt"]
description = "Optionally, specify: '--exitfirst --failed-first --new-first -vv --beartype-packages=mdformat_admon'"
extras = ["test"]

[tool.tox.env."py312-pre-commit"]
commands = [["pre-commit", "run", "--all-files", {default = [], extend = true, replace = "posargs"}]]
Expand All @@ -168,7 +175,7 @@ skip_install = true

[tool.tox.env."py39-test"]
commands = [["pytest", "--cov=mdformat_admon"]]
deps = ["--requirement=tests/requirements.txt"]
extras = ["test"]

[tool.tox.env_run_base]
# Validates that commands are set
Expand Down
21 changes: 18 additions & 3 deletions tests/format/test_format.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
from __future__ import annotations

from itertools import chain
from pathlib import Path
from typing import TypeVar

import mdformat
import pytest
from markdown_it.utils import read_fixture_file

from tests.helpers import print_text

FIXTURE_PATH = Path(__file__).parent / "fixtures/text.md"
fixtures = read_fixture_file(FIXTURE_PATH)
T = TypeVar("T")


def flatten(nested_list: list[list[T]]) -> list[T]:
return [*chain(*nested_list)]


fixtures = flatten(
[
read_fixture_file(Path(__file__).parent / "fixtures" / fixture_path)
for fixture_path in ("text.md",)
],
)


@pytest.mark.parametrize(
("line", "title", "text", "expected"),
fixtures,
ids=[f[1] for f in fixtures],
)
def test_text_fixtures(line, title, text, expected):
def test_format_fixtures(line, title, text, expected):
output = mdformat.text(text, extensions={"admon"})
print_text(output, expected)
assert output.rstrip() == expected.rstrip()
3 changes: 0 additions & 3 deletions tests/requirements.txt

This file was deleted.

0 comments on commit 1aeba13

Please sign in to comment.