Skip to content

Commit

Permalink
Look up the Mermaid files in site packages' directory
Browse files Browse the repository at this point in the history
Signed-off-by: Artyom Vancyan <[email protected]>
  • Loading branch information
ArtyomVancyan committed May 31, 2023
1 parent f86acd8 commit 8b1175c
Showing 1 changed file with 13 additions and 4 deletions.
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"))

0 comments on commit 8b1175c

Please sign in to comment.