diff options
author | André Bargull <andre.bargull@gmail.com> | 2017-05-04 09:29:37 -0700 |
---|---|---|
committer | André Bargull <andre.bargull@gmail.com> | 2017-05-04 09:29:37 -0700 |
commit | dd1f55a3dce69cccefcd988d1f67a10a8890ad95 (patch) | |
tree | 7eb644ef43968669f8be6f1d39860cf238ac1e1a /tools | |
parent | c1e2572143efea790eb7ef48199e3485faa66e78 (diff) | |
download | qtdeclarative-testsuites-dd1f55a3dce69cccefcd988d1f67a10a8890ad95.tar.gz |
Allow to specify negative frontmatter values in templates files
Diffstat (limited to 'tools')
-rw-r--r-- | tools/generation/lib/template.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/generation/lib/template.py b/tools/generation/lib/template.py index 53bd03ba1..14cc3caeb 100644 --- a/tools/generation/lib/template.py +++ b/tools/generation/lib/template.py @@ -3,6 +3,7 @@ import os, re import codecs, yaml +from collections import OrderedDict from util.find_comments import find_comments from util.parse_yaml import parse_yaml @@ -151,23 +152,33 @@ class Template: features = [] features += case_values['meta'].get('features', []) features += self.attribs['meta'].get('features', []) + features = list(OrderedDict.fromkeys(features)) if len(features): lines += ['features: ' + yaml.dump(features).strip()] flags = ['generated'] flags += case_values['meta'].get('flags', []) flags += self.attribs['meta'].get('flags', []) + flags = list(OrderedDict.fromkeys(flags)) lines += ['flags: ' + yaml.dump(flags).strip()] includes = [] includes += case_values['meta'].get('includes', []) includes += self.attribs['meta'].get('includes', []) + includes = list(OrderedDict.fromkeys(includes)) if len(includes): lines += ['includes: ' + yaml.dump(includes).strip()] if case_values['meta'].get('negative'): + if self.attribs['meta'].get('negative'): + raise Exception('Cannot specify negative in case and template file') + negative = case_values['meta'].get('negative') + else: + negative = self.attribs['meta'].get('negative') + + if negative: lines += ['negative:'] - as_yaml = yaml.dump(case_values['meta'].get('negative'), + as_yaml = yaml.dump(negative, default_flow_style=False) lines += indent(as_yaml.strip(), ' ').split('\n') |