Closed
Bug 849767
Opened 12 years ago
Closed 7 years ago
Improve Exception message when there is are syntax errors
Categories
(Testing :: Mozbase, enhancement)
Testing
Mozbase
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: zcampbell, Unassigned)
Details
(Whiteboard: [mozbase])
We had a commit that put an incorrect default tag into a manifest file. It was inserted as "DEFAULT" rather than "[DEFAULT]"
ManifestDestiny then failed to parse this tag correctly causing our test run to fail.
For some of our less-technical users (myself even) that review results of tests this error message is not very helpful.
I'd like to ask for a more relevant failure message or handling of an invalid tag so the person reviewing the test results can resolve the problem or know who the right person to ask is.
Reporter | ||
Comment 1•12 years ago
|
||
Traceback (most recent call last):
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/bin/gaiatest", line 8, in <module>
load_entry_point('gaiatest==0.8', 'console_scripts', 'gaiatest')()
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/gaia-ui-tests/gaiatest/runtests.py", line 17, in main
cli(runner_class=GaiaTestRunner)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/marionette_client-0.5.19-py2.7.egg/marionette/runtests.py", line 698, in cli
runner = startTestRunner(runner_class, options, tests)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/marionette_client-0.5.19-py2.7.egg/marionette/runtests.py", line 693, in startTestRunner
runner.run_tests(tests, testtype=options.type)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/marionette_client-0.5.19-py2.7.egg/marionette/runtests.py", line 352, in run_tests
self.run_test(test, testtype)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/marionette_client-0.5.19-py2.7.egg/marionette/runtests.py", line 419, in run_test
manifest.read(filepath)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/ManifestDestiny-0.5.6-py2.7.egg/manifestparser/manifestparser.py", line 470, in read
self._read(here, filename, defaults)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/ManifestDestiny-0.5.6-py2.7.egg/manifestparser/manifestparser.py", line 426, in _read
self._read(root, include_file, include_defaults)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/ManifestDestiny-0.5.6-py2.7.egg/manifestparser/manifestparser.py", line 407, in _read
sections = read_ini(fp=filename, variables=defaults, strict=self.strict)
File "/var/jenkins/workspace/b2g.unagi.gaia.v1-train.ui/.env/local/lib/python2.7/site-packages/ManifestDestiny-0.5.6-py2.7.egg/manifestparser/manifestparser.py", line 345, in read_ini
raise Exception('No sections found')
Exception: No sections found
+ OUT=1
Reporter | ||
Updated•12 years ago
|
Assignee: nobody → jhammel
Updated•12 years ago
|
Whiteboard: [mozbase]
Updated•12 years ago
|
Component: ManifestParser → Mozbase
QA Contact: hskupin
Comment 3•12 years ago
|
||
Is there an example file that we can use?
Probably in general we should try to do similar to what ConfigParser does on most cases. Once 2.7 is reality for us backwoods developers, it will become the default.
Reporter | ||
Comment 4•12 years ago
|
||
I can double check this for you tomorrow but if you take this test ini file:
https://github.com/mozilla/mozbase/blob/master/manifestdestiny/tests/mozmill-restart-example.ini
and remove the [ ] from line 1 then a test run should fail.
Comment 5•12 years ago
|
||
:jgriffin, any ideas here? The bug is a bit vague: while the example cited is for a missing section, "syntax errors" can encompass quite a bit, so I don't know if we want to tighten the scope or not. Even for the specific issue, I'm not sure what is desired or a good solution. FWIW, I did the best I could (easily) to emulate what ConfigParser did for the various errors. At some point, we'll kill read_ini in favor of ConfigParser.
Comment 6•12 years ago
|
||
ConfigParser provides a slightly better message:
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: test.cfg, line: 1
'DEFAULT\n'
and (if a valid section header is present along with an invalid one):
ConfigParser.ParsingError: File contains parsing errors: test.cfg
[line 4]: 'TEST\n'
We could opt to either leave things as is since we intend to move to ConfigParser soon, or to update read_ini to better match the ConfigParser parsing errors.
Updated•12 years ago
|
Assignee: jgriffin → nobody
Comment 7•7 years ago
|
||
Mass closing bugs with no activity in 2+ years. If this bug is important to you, please re-open.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Comment 8•7 years ago
|
||
The current failure message is: "Expected a comment or section, instead found 'DEFAULT'". So I think this is enough.
Resolution: WONTFIX → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•