tests/aliases.py

Thu, 26 Aug 2021 22:04:33 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 26 Aug 2021 22:04:33 +0300
changeset 152
5e347a96869a
parent 73
9664583cd1c9
permissions
-rw-r--r--

removed some alias tests that aren't mandated by the official header specification

73
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 from testsuite import problem_type, report_problem
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 import linetypes
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 @problem_type(
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 'alias-not-prefixed-with-equals',
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 severity = 'hold',
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 message = 'description of alias files must start with a "="',
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 )
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 def alias_tests(model):
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 if model.header.valid and 'Alias' in model.header.qualifiers:
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 if not model.header.description.startswith('='):
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 yield report_problem(
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 'alias-not-prefixed-with-equals',
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 bad_object = model.body[0],
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 )
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 manifest = {
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 'tests': [
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 alias_tests
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 ],
9664583cd1c9 added alias tests
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 }

mercurial