Skip to content

Commit

Permalink
build: copier-auto-update
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKing committed Mar 30, 2024
1 parent e9931ec commit 3ab946d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Answer file maintained by Copier for: https://github.com/KyleKing/mdformat-plugin-template
# DO NOT MODIFY THIS FILE. Edit by re-running copier and changing responses to the questions
# Check into version control.
_commit: 0.1.2
_commit: 0.1.3
_src_path: gh:KyleKing/mdformat-plugin-template
author_email: dev.act.kyle@gmail.com
author_name: Kyle King
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: pre-commit/action@v3
- uses: pre-commit/action@v3.0.1
tests:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ export eval $(envchain FLIT env | grep FLIT_PASSWORD=)
flit publish
```

or trigger the GitHub Action job, by creating a release with a tag equal to the version, e.g. `v0.0.1` and updating the version in `mdformat_admon/__init__.py`.
or trigger the GitHub Action job, by creating a release with a tag equal to the version, e.g. `v0.0.1` and updating the version in `mdformat_gfm_alerts/__init__.py`.

Note, this requires generating an API key on PyPi and adding it to the repository `Settings/Secrets`, under the name `PYPI_KEY`.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ gfm_alerts = "mdformat_gfm_alerts"
dev = ["pre-commit"]
test = [
"pytest >= 7.4.4",
"pytest-beartype >= 0.0.2",
"pytest-cov >= 4.1.0",
]

Expand All @@ -44,7 +45,7 @@ ignore_patterns = []
now = true
patterns = ["*.md", "*.py"]
runner = "tox"
runner_args = ["-e", "py38"]
runner_args = ["-e", "py38-beartype"]

[tool.tomlsort]
all = true
Expand Down
23 changes: 17 additions & 6 deletions tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
"""Test Helpers."""

from __future__ import annotations

import re

_SHOW_TEXT = True # PLANNED: Make configurable based on pytest CLI


def _print(content: str, show_whitespace: bool) -> None:
if show_whitespace:
raise NotImplementedError("To use, port logic from `mdformat_mkdocs`")
def separate_indent(line: str) -> tuple[str, str]:
"""Separate leading indent from content. Also used by the test suite."""
re_indent = re.compile(r"(?P<indent>\s*)(?P<content>[^\s]?.*)")
match = re_indent.match(line)
assert match is not None # for pyright
return (match["indent"], match["content"])


def _print(content: str, show_whitespace: bool) -> None:
for line in content.split("\n"):
print(line)
indent, content = separate_indent(line)
visible_indents = indent.replace(" ", "→").replace("\t", "➤")
print((visible_indents if show_whitespace else indent) + content)


def print_text(output: str, expected: str, show_whitespace: bool = False) -> None:
"""Conditionall print text for debugging."""
if _SHOW_TEXT:
print("-- Output --")
_print(output.strip(), show_whitespace)
_print(output, show_whitespace)
print("-- Expected --")
_print(expected.strip(), show_whitespace)
_print(expected, show_whitespace)
print("-- <End> --")
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{38}
py{38}-beartype
py{312}-cov
py{312}-pre-commit
py{38}-hook
Expand All @@ -9,9 +9,9 @@ envlist =
isolated_build = True
skip_missing_interpreters = False

[testenv:py{38}]
[testenv:py{38}-beartype]
extras = test
commands = pytest {posargs} --ff --nf -vv
commands = pytest {posargs} --ff --nf -vv --exitfirst --beartype-packages='mdformat_gfm_alerts'

[testenv:py{312}-cov]
extras = test
Expand Down

0 comments on commit 3ab946d

Please sign in to comment.