Skip to content

Commit f8a5e46

Browse files
committed
Skip test if no fixtures
1 parent 64d98f4 commit f8a5e46

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎foundation/tests/test_home.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@
99
tests is to catch regressions in routing, middleware, and template loading,
1010
not to assert specific page content.
1111
"""
12+
import os
13+
import unittest
14+
1215
from django.test import TestCase
1316

1417

18+
SAMPLE_DATA_PATH = os.path.join(
19+
os.path.dirname(__file__), "fixtures", "sample_data.json"
20+
)
21+
22+
1523
class HomePageTests(TestCase):
1624
def test_home_does_not_error(self):
1725
response = self.client.get("/")
@@ -39,6 +47,10 @@ def test_admin_login_page_renders(self):
3947
self.assertContains(response, "csrfmiddlewaretoken")
4048

4149

50+
@unittest.skipUnless(
51+
os.path.exists(SAMPLE_DATA_PATH),
52+
"sample_data.json not present — run `make fixtures-dump` to enable.",
53+
)
4254
class HomePageWithSampleDataTests(TestCase):
4355
"""Tests that load a real slice of CMS data via fixtures and exercise
4456
the actual page-rendering pipeline. Regenerate the fixture with

0 commit comments

Comments
 (0)