Skip to content

Commit

Permalink
Configure tox for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtyomVancyan committed Mar 12, 2023
1 parent d61affd commit 3c8048f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.tox
*.egg-info
mermaid.js
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = ["setuptools>=42.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = ["ignore::DeprecationWarning"]
Empty file added tests/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.conf import settings


def pytest_configure():
settings.configure(INSTALLED_APPS=["django_mermaid.apps.MermaidConfig"])
3 changes: 3 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tox==3.24.3
pytest==6.2.5
pytest-django==4.5.2
8 changes: 8 additions & 0 deletions tests/test_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django_mermaid.templatetags.mermaid import mermaid


def test_tag_renders():
assert mermaid("graph LR; A-->B;") == (
"""<div class="mermaid">graph LR; A-->B;</div><script src="mermaid.js"></script>"""
"""<script>mermaid.initialize({"startOnLoad": true, theme: "default"});</script>"""
)
17 changes: 17 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tox]
envlist =
py{36,38,310}-django32
py{38,39,310}-django40
py{39,310,311}-django{41,main}

[testenv]
deps =
djangomain: https://github.com/django/django/tarball/main
django42: django<4.3
django41: django<4.2
django40: django<4.1
django32: django<3.3
-r{toxinidir}/tests/requirements.txt
commands =
pip install -e .
pytest

0 comments on commit 3c8048f

Please sign in to comment.