Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ jobs:
- python: "3.11"
env: py311-django41

- python: "3.9"
env: py39-django42
- python: "3.10"
env: py310-django42
- python: "3.11"
env: py311-django42

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
Expand All @@ -59,7 +66,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip
python -m pip install -e .
sh build.sh
pip install tox tox-gh-actions
- name: Run tests using tox
run: tox -e ${{ matrix.env }}
run: tox -e ${{ matrix.env }}
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include src/django_mermaid/static/mermaid *
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# last version of `build` supporting Python 3.6
pip install build==0.9.0

# build the wheel and install it
WHEEL_NAME=$(python -m build | grep -Po "django_mermaid-.*\.whl" | tail -n 1)
pip install dist/$WHEEL_NAME
17 changes: 13 additions & 4 deletions tests/test_tag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from os.path import dirname
from os.path import exists
from os.path import join

Expand All @@ -8,6 +7,15 @@
from django.test import override_settings
from django_mermaid.templatetags import DEFAULT_THEME

try:
import site

site_packages = site.getsitepackages()[0]
except (ImportError, IndexError):
import sysconfig

site_packages = sysconfig.get_paths()["purelib"]


def test_tag_use_in_template(version):
theme = getattr(settings, "MERMAID_THEME", DEFAULT_THEME)
Expand Down Expand Up @@ -63,6 +71,7 @@ def test_tag_use_custom_theme_variables_with_base_theme(version):
)


def test_tag_use_custom_version(version):
static_dir = join(dirname(__file__), "..", "src", "django_mermaid", "static")
assert exists(join(static_dir, "mermaid", version, "mermaid.js"))
def test_tag_use_custom_version():
static_dir = join(site_packages, "django_mermaid", "static")
assert exists(join(static_dir, "mermaid", "8.6.3", "mermaid.js"))
assert exists(join(static_dir, "mermaid", "9.4.3", "mermaid.js"))
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ envlist =
py{36,38,39}-django21
py{36,38,310}-django32
py{38,39,310}-django40
py{39,310,311}-django{41,main}
py{39,310,311}-django{41,42}
py{310,311}-djangomain

[testenv]
deps =
Expand All @@ -16,6 +17,7 @@ deps =
django21: django<2.2
django11: django<2.0
-r{toxinidir}/tests/requirements.txt
allowlist_externals = sh
commands =
pip install -e .
pytest
sh build.sh
pytest