generated from executablebooks/mdformat-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Do not modify multi-line code from: https://github.com/KyleKing/mdformat-mkdocs/issues/23 | ||
. | ||
=== "duty" | ||
```python title="duties.py" | ||
@duty(silent=True) | ||
def coverage(ctx): | ||
ctx.run("coverage combine", nofail=True) | ||
ctx.run("coverage report --rcfile=config/coverage.ini", capture=False) | ||
ctx.run("coverage html --rcfile=config/coverage.ini") | ||
|
||
|
||
@duty | ||
def test(ctx, match: str = ""): | ||
py_version = f"{sys.version_info.major}{sys.version_info.minor}" | ||
os.environ["COVERAGE_FILE"] = f".coverage.{py_version}" | ||
ctx.run( | ||
["pytest", "-c", "config/pytest.ini", "-n", "auto", "-k", match, "tests"], | ||
title="Running tests", | ||
) | ||
``` | ||
. | ||
=== "duty" | ||
```python title="duties.py" | ||
@duty(silent=True) | ||
def coverage(ctx): | ||
ctx.run("coverage combine", nofail=True) | ||
ctx.run("coverage report --rcfile=config/coverage.ini", capture=False) | ||
ctx.run("coverage html --rcfile=config/coverage.ini") | ||
|
||
|
||
@duty | ||
def test(ctx, match: str = ""): | ||
py_version = f"{sys.version_info.major}{sys.version_info.minor}" | ||
os.environ["COVERAGE_FILE"] = f".coverage.{py_version}" | ||
ctx.run( | ||
["pytest", "-c", "config/pytest.ini", "-n", "auto", "-k", match, "tests"], | ||
title="Running tests", | ||
) | ||
``` | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pathlib import Path | ||
|
||
import mdformat | ||
import pytest | ||
from markdown_it.utils import read_fixture_file | ||
|
||
from ..helpers import print_text | ||
|
||
FIXTURE_PATH = Path(__file__).parent / "fixtures/content_tabs.md" | ||
fixtures = read_fixture_file(FIXTURE_PATH) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("line", "title", "text", "expected"), | ||
fixtures, | ||
ids=[f[1] for f in fixtures], | ||
) | ||
def test_content_tabs_fixtures(line, title, text, expected): | ||
output = mdformat.text(text, extensions={"mkdocs", "admonition"}) | ||
print_text(output, expected) | ||
assert output.rstrip() == expected.rstrip() |