Skip to content

Commit 6923280

Browse files
committed
Move existing test to new test_package module
I think it's a better fit there, because the other tests all concern the template tag itself. Please note that the test fails for me locally.
1 parent 3f08925 commit 6923280

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

tests/test_package.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
from django.test import override_settings
1+
from os.path import exists, join
22
from unittest.mock import patch
3+
34
from django.apps import apps
5+
from django.test import override_settings
6+
7+
try:
8+
import site
9+
10+
site_packages = site.getsitepackages()[0]
11+
except (ImportError, IndexError):
12+
import sysconfig
13+
14+
site_packages = sysconfig.get_paths()["purelib"]
415

516
@override_settings(MERMAID_USE_CDN=False)
617
@patch('django_mermaid.apps.download_if_necessary')
@@ -18,4 +29,10 @@ def test_download_not_called_when_use_cdn_true(mock_download):
1829
app_config = apps.get_app_config('django_mermaid')
1930
app_config.ready()
2031

21-
mock_download.assert_not_called()
32+
mock_download.assert_not_called()
33+
34+
35+
def test_tag_use_custom_version():
36+
static_dir = join(site_packages, "django_mermaid", "static")
37+
assert exists(join(static_dir, "mermaid", "8.6.3", "mermaid.js"))
38+
assert exists(join(static_dir, "mermaid", "9.4.3", "mermaid.js"))

tests/test_tag.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
from os.path import exists
2-
from os.path import join
3-
41
import pytest
52
from django.conf import settings
63
from django.template import Context
@@ -125,7 +122,3 @@ def test_tag_use_custom_theme_variables_with_base_theme(version, template_code):
125122
)
126123

127124

128-
def test_tag_use_custom_version():
129-
static_dir = join(site_packages, "django_mermaid", "static")
130-
assert exists(join(static_dir, "mermaid", "8.6.3", "mermaid.js"))
131-
assert exists(join(static_dir, "mermaid", "9.4.3", "mermaid.js"))

0 commit comments

Comments
 (0)