[Piglit] [PATCH 06/34] generated_tests: use future division in mako templates
Dylan Baker
baker.dylan.c at gmail.com
Fri Feb 20 18:17:53 PST 2015
This provides consistency between the behavior of python2 and python3
There are no changes in the generated files before and after this
change, it simply ensures that things work the same for both versions of
python.
---
generated_tests/templates/__init__.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/generated_tests/templates/__init__.py b/generated_tests/templates/__init__.py
index 1bcc828..b796eff 100644
--- a/generated_tests/templates/__init__.py
+++ b/generated_tests/templates/__init__.py
@@ -36,6 +36,9 @@ MAKO_TEMP_DIR = os.path.join(tempfile.gettempdir(),
TEMPLATE_DIR = os.path.abspath(os.path.dirname(__file__))
+# Future functions to be used in all templates
+_FUTURES = ['division']
+
def template_file(generator, template):
"""Get a single template file from the templates directory.
@@ -57,6 +60,7 @@ def template_file(generator, template):
return Template(filename=os.path.join(TEMPLATE_DIR, generator, template),
module_directory=os.path.join(MAKO_TEMP_DIR, generator),
+ future_imports=_FUTURES,
output_encoding='utf-8')
@@ -78,4 +82,5 @@ def template_dir(generator):
return TemplateLookup(
directories=[os.path.join(TEMPLATE_DIR, generator)],
module_directory=os.path.join(MAKO_TEMP_DIR, generator),
+ future_imports=_FUTURES,
output_encoding='utf-8')
--
2.3.0
More information about the Piglit
mailing list