Skip to content

Commit 7475586

Browse files
Update the tox environments (GH-15)
2 parents 9b31b0e + 09b960c commit 7475586

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ jobs:
5050
- python: "3.11"
5151
env: py311-django41
5252

53+
- python: "3.9"
54+
env: py39-django42
55+
- python: "3.10"
56+
env: py310-django42
57+
- python: "3.11"
58+
env: py311-django42
59+
5360
steps:
5461
- uses: actions/checkout@v2
5562
- name: Set up Python ${{ matrix.python }}
@@ -59,7 +66,7 @@ jobs:
5966
- name: Install dependencies
6067
run: |
6168
pip install --upgrade pip
62-
python -m pip install -e .
69+
sh build.sh
6370
pip install tox tox-gh-actions
6471
- name: Run tests using tox
65-
run: tox -e ${{ matrix.env }}
72+
run: tox -e ${{ matrix.env }}

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include src/django_mermaid/static/mermaid *

build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# last version of `build` supporting Python 3.6
4+
pip install build==0.9.0
5+
6+
# build the wheel and install it
7+
WHEEL_NAME=$(python -m build | grep -Po "django_mermaid-.*\.whl" | tail -n 1)
8+
pip install dist/$WHEEL_NAME

tests/test_tag.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from os.path import dirname
21
from os.path import exists
32
from os.path import join
43

@@ -8,6 +7,15 @@
87
from django.test import override_settings
98
from django_mermaid.templatetags import DEFAULT_THEME
109

10+
try:
11+
import site
12+
13+
site_packages = site.getsitepackages()[0]
14+
except (ImportError, IndexError):
15+
import sysconfig
16+
17+
site_packages = sysconfig.get_paths()["purelib"]
18+
1119

1220
def test_tag_use_in_template(version):
1321
theme = getattr(settings, "MERMAID_THEME", DEFAULT_THEME)
@@ -63,6 +71,7 @@ def test_tag_use_custom_theme_variables_with_base_theme(version):
6371
)
6472

6573

66-
def test_tag_use_custom_version(version):
67-
static_dir = join(dirname(__file__), "..", "src", "django_mermaid", "static")
68-
assert exists(join(static_dir, "mermaid", version, "mermaid.js"))
74+
def test_tag_use_custom_version():
75+
static_dir = join(site_packages, "django_mermaid", "static")
76+
assert exists(join(static_dir, "mermaid", "8.6.3", "mermaid.js"))
77+
assert exists(join(static_dir, "mermaid", "9.4.3", "mermaid.js"))

tox.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ envlist =
44
py{36,38,39}-django21
55
py{36,38,310}-django32
66
py{38,39,310}-django40
7-
py{39,310,311}-django{41,main}
7+
py{39,310,311}-django{41,42}
8+
py{310,311}-djangomain
89

910
[testenv]
1011
deps =
@@ -16,6 +17,7 @@ deps =
1617
django21: django<2.2
1718
django11: django<2.0
1819
-r{toxinidir}/tests/requirements.txt
20+
allowlist_externals = sh
1921
commands =
20-
pip install -e .
21-
pytest
22+
sh build.sh
23+
pytest

0 commit comments

Comments
 (0)