diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 36ba56b..f0f792f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 }} @@ -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 }} \ No newline at end of file + run: tox -e ${{ matrix.env }} diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..3d9f380 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include src/django_mermaid/static/mermaid * \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..fce52ab --- /dev/null +++ b/build.sh @@ -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 \ No newline at end of file diff --git a/tests/test_tag.py b/tests/test_tag.py index 60170d3..0da99e1 100644 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -1,4 +1,3 @@ -from os.path import dirname from os.path import exists from os.path import join @@ -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) @@ -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")) diff --git a/tox.ini b/tox.ini index 1cbe5e0..41e3122 100644 --- a/tox.ini +++ b/tox.ini @@ -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 = @@ -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 \ No newline at end of file + sh build.sh + pytest