annotate tests/test_included.py @ 258:e21f013586d0

get variables and feed them right back
author Jeff Hammel <k0scist@gmail.com>
date Sat, 27 May 2017 15:23:44 -0700
parents 28d76b139fdd
children 15ade7ad64da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
257
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 """
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 tests for templates included in the package
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 """
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 included_templates = set(['python-package'])
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
258
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
7 import tempfile
257
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 from makeitso.makeitso import get_entry_points
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 def test_included_template():
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 """ensure we are packaging included template correctly"""
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 # ensure template is present in entry points
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 entry_points = get_entry_points()
28d76b139fdd add test for included templates
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 assert included_templates.issubset(entry_points)
258
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
16
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
17 # render each template
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
18 for template_name in included_templates:
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
19 template = entry_points[template_name]()
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
20
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
21 # get the variables
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
22 missing = template.missing()
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
23 variables = {variable: variable
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
24 for variable in missing}
e21f013586d0 get variables and feed them right back
Jeff Hammel <k0scist@gmail.com>
parents: 257
diff changeset
25