Skip to content

Commit 3c8048f

Browse files
committed
Configure tox for tests
1 parent d61affd commit 3c8048f

File tree

7 files changed

+41
-0
lines changed

7 files changed

+41
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
2+
.tox
23
*.egg-info
34
mermaid.js

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
requires = ["setuptools>=42.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.pytest.ini_options]
6+
testpaths = ["tests"]
7+
filterwarnings = ["ignore::DeprecationWarning"]

tests/__init__.py

Whitespace-only changes.

tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.conf import settings
2+
3+
4+
def pytest_configure():
5+
settings.configure(INSTALLED_APPS=["django_mermaid.apps.MermaidConfig"])

tests/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tox==3.24.3
2+
pytest==6.2.5
3+
pytest-django==4.5.2

tests/test_tag.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from django_mermaid.templatetags.mermaid import mermaid
2+
3+
4+
def test_tag_renders():
5+
assert mermaid("graph LR; A-->B;") == (
6+
"""<div class="mermaid">graph LR; A-->B;</div><script src="mermaid.js"></script>"""
7+
"""<script>mermaid.initialize({"startOnLoad": true, theme: "default"});</script>"""
8+
)

tox.ini

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[tox]
2+
envlist =
3+
py{36,38,310}-django32
4+
py{38,39,310}-django40
5+
py{39,310,311}-django{41,main}
6+
7+
[testenv]
8+
deps =
9+
djangomain: https://github.com/django/django/tarball/main
10+
django42: django<4.3
11+
django41: django<4.2
12+
django40: django<4.1
13+
django32: django<3.3
14+
-r{toxinidir}/tests/requirements.txt
15+
commands =
16+
pip install -e .
17+
pytest

0 commit comments

Comments
 (0)