Closed Bug 811330 Opened 7 years ago Closed 7 years ago

XML report generation fails when any tests are skipped

Categories

(Testing :: Marionette, defect)

defect
Not set

Tracking

(firefox18 fixed, firefox19 fixed)

RESOLVED FIXED
mozilla19
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: davehunt, Assigned: davehunt)

Details

Attachments

(1 file)

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
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.
Attachment #681072 - Flags: review?(jgriffin)
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!
Attachment #681072 - Flags: review?(jgriffin) → review+
Assignee: nobody → dhunt
https://hg.mozilla.org/mozilla-central/rev/baba249d52f8
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.