Last Comment Bug 811330 - XML report generation fails when any tests are skipped
: XML report generation fails when any tests are skipped
Status: RESOLVED FIXED
:
Product: Testing
Classification: Components
Component: Marionette (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla19
Assigned To: Dave Hunt (:davehunt)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-13 09:01 PST by Dave Hunt (:davehunt)
Modified: 2012-11-14 18:51 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
fixed
fixed


Attachments
Fix report when tests are skipped using unittest.skip (498 bytes, patch)
2012-11-13 09:07 PST, Dave Hunt (:davehunt)
jgriffin: review+
Details | Diff | Splinter Review

Description Dave Hunt (:davehunt) 2012-11-13 09:01:23 PST
If a test is skipped and you have provided the command line option to save an XML report, an exception is thrown:

$ gaiatest --address=localhost:2828 --type=b2g --xml-output=results.xml gaiatest/tests/test_browser.py
starting httpd
running webserver on http://192.168.252.204:43211/
TEST-START test_browser.py
test_browser_basic (test_browser.TestBrowser) ... skipped "Don't want to run this on CI"

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK (skipped=1)

SUMMARY
-------
passed: 0
failed: 0
todo: 1
Traceback (most recent call last):
  File "/home/mozilla/.virtualenvs/Gaia/bin/gaiatest", line 8, in <module>
    load_entry_point('gaiatest==0.2', 'console_scripts', 'gaiatest')()
  File "/home/mozilla/gaia-ui-tests/gaiatest/runtests.py", line 17, in main
    cli(runner_class=GaiaTestRunner)
  File "/home/mozilla/mozilla-central/testing/marionette/client/marionette/runtests.py", line 718, in cli
    runner = startTestRunner(runner_class, options, tests)
  File "/home/mozilla/mozilla-central/testing/marionette/client/marionette/runtests.py", line 713, in startTestRunner
    runner.run_tests(tests, testtype=options.type)
  File "/home/mozilla/mozilla-central/testing/marionette/client/marionette/runtests.py", line 374, in run_tests
    f.write(self.generate_xml(self.results))
  File "/home/mozilla/mozilla-central/testing/marionette/client/marionette/runtests.py", line 564, in generate_xml
    _extract_xml(*tup, result='Skip')
  File "/home/mozilla/mozilla-central/testing/marionette/client/marionette/runtests.py", line 520, in _extract_xml
    t.appendChild(f)
UnboundLocalError: local variable 'f' referenced before assignment
Comment 1 Dave Hunt (:davehunt) 2012-11-13 09:07:28 PST
Created attachment 681072 [details] [diff] [review]
Fix report when tests are skipped using unittest.skip

This patch fixes the issue for tests skipped using unittest.skip, however there appears to still be an issue when tests are skipped via a manifest.
Comment 2 Jonathan Griffin (:jgriffin) 2012-11-13 10:16:05 PST
Comment on attachment 681072 [details] [diff] [review]
Fix report when tests are skipped using unittest.skip

Review of attachment 681072 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch!
Comment 3 Jonathan Griffin (:jgriffin) 2012-11-14 14:46:42 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/baba249d52f8
Comment 4 Jonathan Griffin (:jgriffin) 2012-11-14 14:48:12 PST
https://hg.mozilla.org/releases/mozilla-aurora/rev/da9e6a7f7ac7
Comment 5 Ryan VanderMeulen [:RyanVM] 2012-11-14 18:51:15 PST
https://hg.mozilla.org/mozilla-central/rev/baba249d52f8

Note You need to log in before you can comment on or make changes to this bug.