Skip to content

Commit 0f72704

Browse files
committed
test: do not run jinja2 demo test if jinja2 missing.
1 parent f37b346 commit 0f72704

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/test_demo.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pytest
12
import unittest
23
import os, sys, shutil
34

@@ -23,6 +24,14 @@ def captured_output():
2324
finally:
2425
sys.stdout, sys.stderr = old_out, old_err
2526

27+
try:
28+
import jinja2
29+
skip_jinja2 = lambda func, *args, **kwargs: func
30+
except ImportError:
31+
from .pytest_patcher import mark_class
32+
skip_jinja2 = mark_class(pytest.mark.skip(
33+
reason='Skipping Jinja2 tests: jinja2 library not available'))
34+
2635
class TestDemo(unittest.TestCase):
2736
def setUp(self):
2837
self.home = os.path.abspath('_test_demo')
@@ -73,6 +82,7 @@ def testDemoClassic(self):
7382
def testDemoMinimal(self):
7483
self.run_install_demo('../templates/minimal', db="sqlite")
7584

85+
@skip_jinja2
7686
def testDemoJinja(self):
7787
self.run_install_demo('jinja2', db="anydbm")
7888

0 commit comments

Comments
 (0)