Less obscure test suites template
diff --git a/tests/scripts/generate_test_code.py b/tests/scripts/generate_test_code.py
index 26d1c29..ce6f88c 100755
--- a/tests/scripts/generate_test_code.py
+++ b/tests/scripts/generate_test_code.py
@@ -122,7 +122,7 @@
functions are populated with checks and return codes by this script.
Template file contains "replacement" fields that are formatted
-strings processed by Python str.format() method.
+strings processed by Python string.Template.substitute() method.
This script:
============
@@ -132,9 +132,9 @@
This script replaces following fields in the template and generates
the test source file:
-{test_common_helpers} <-- All common code from helpers.function
+$test_common_helpers <-- All common code from helpers.function
is substituted here.
-{functions_code} <-- Test functions are substituted here
+$functions_code <-- Test functions are substituted here
from the input test_suit_xyz.function
file. C preprocessor checks are generated
for the build dependencies specified
@@ -143,21 +143,21 @@
functions with code to expand the
string parameters read from the data
file.
-{expression_code} <-- This script enumerates the
+$expression_code <-- This script enumerates the
expressions in the .data file and
generates code to handle enumerated
expression Ids and return the values.
-{dep_check_code} <-- This script enumerates all
+$dep_check_code <-- This script enumerates all
build dependencies and generate
code to handle enumerated build
dependency Id and return status: if
the dependency is defined or not.
-{dispatch_code} <-- This script enumerates the functions
+$dispatch_code <-- This script enumerates the functions
specified in the input test data file
and generates the initializer for the
function table in the template
file.
-{platform_code} <-- Platform specific setup and test
+$platform_code <-- Platform specific setup and test
dispatch code.
"""
@@ -167,6 +167,7 @@
import os
import re
import sys
+import string
import argparse
@@ -967,7 +968,7 @@
for line_no, line in enumerate(template_f.readlines(), 1):
# Update line number. +1 as #line directive sets next line number
snippets['line_no'] = line_no + 1
- code = line.format(**snippets)
+ code = string.Template(line).substitute(**snippets)
c_f.write(code)