Skip to content
Snippets Groups Projects
Commit cfa5495b authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

mkexp: reading of EXP_DESCRIPTION from initial comment now also discards...

mkexp: reading of EXP_DESCRIPTION from initial comment now also discards leading and trailing lines that only contain white space and comment characters
parent e4bf671d
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,8 @@ Configuration
-------------
* Made 'time' module available in eval(...)
* Reading of EXP_DESCRIPTION from initial comment now also discards leading and
trailing lines that only contain white space and comment characters
Release 1.0.3
=============
......
......@@ -426,7 +426,7 @@ class ExpConfig(ConfigObj):
# Extract experiment description from initial comment
# if not set explicitly
if not pre_config.has_key('EXP_DESCRIPTION'):
is_empty = lambda s: re.match(r'^\s*$', s)
is_empty = lambda s: re.match(r'^[\s#]*$', s)
rm_comment = lambda s: re.sub(r'^\s*# ?', '', s)
pre_config['EXP_DESCRIPTION'] = "\n".join(
reversed(list(
......
......@@ -462,6 +462,29 @@ class ContentTestCase(MkexpSimpleTestCase):
VALUE = "eval(time.strftime('%Y-%m-%d', time.gmtime(0)))"
""")
def test_initial_comment_boilerplate(self):
writeconfig(self.exp_id, """
######
# #
# 42
# #
######
EXP_TYPE =
[jobs]
[["""+self.job_id+"""]]
""")
writetemplate(self.exp_id, self.job_id, """
%{EXP_DESCRIPTION}
""")
expected = align("""
42
""")
ignore = output(script("mkexp "+self.exp_id+".config"))
result = readfile(join("test", "experiments", self.exp_id,
self.exp_id+"."+self.job_id))
result = align(result)
self.assertMultiLineEqual(expected, result)
class JinjaTemplateTestCase(MkexpSimpleTestCase):
def test_ignore_blocks(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment