diff --git a/CHANGES.rst b/CHANGES.rst index 308523c37b27c218c60f2d6d8a44970768ded749..df724e35b32472dad5e3ff5a9268f22714cf72d2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,6 +18,7 @@ Config ------ * Add option to allow scripts to be non-executable +* Add list of removed jobs to template namespace Tools ----- diff --git a/mkexp b/mkexp index 42b078cfcadfc5385575327d653778735486339f..ad1067af7c6bfa3bd30dadfc866c516403508eff 100755 --- a/mkexp +++ b/mkexp @@ -572,6 +572,7 @@ for subjob, subconfig in jobs_config.items(): var_format = job_config['JOB'].get('.var_format', '${%s}') var_list = set() job_config['jobs'] = {} + job_config['jobs']['.remove'] = (remove_list[1:] if remove_list else []) job_config['jobs'].merge(expconfig.odict(jobs_config)) expconfig.merge_comments(job_config['jobs'], jobs_config) job_config.walk(format_vars, log=var_list, fmt=var_format) diff --git a/test.py b/test.py index e7ac5cf171a91b07285f8be3734f423e97ed6ad6..bb4703934aa8663107d933caf9cba8124e3e7300 100644 --- a/test.py +++ b/test.py @@ -1723,6 +1723,38 @@ class JobSiblingsTestCase(MkexpSimpleTestCase): result = align(result) self.assertMultiLineEqual(expected, result) +class DisabledJobsTestCase(MkexpSimpleTestCase): + + def test_removed_job_in_template(self): + writeconfig(self.exp_id, u""" + [jobs] + .remove = job1 + [[job1]] + [[job2]] + """) + writetemplate(self.exp_id, 'job2', u""" + #% for job in jobs.sections: + %{job} + #% endfor + --- + #% for job in jobs.sections: + #% if job is not in jobs['.remove']: + %{job} + #% endif + #% endfor + """) + expected = align(u""" + job1 + job2 + --- + job2 + """) + ignore = output(script("mkexp "+self.exp_id+".config")) + result = readfile(join("test", "experiments", self.exp_id, + self.exp_id+".job2")) + result = align(result) + self.assertMultiLineEqual(expected, result) + class NativeVariableTestCase(MkexpSimpleTestCase): def test_var_statement(self):