autopilot crashes on failed test

Bug #1154107 reported by Michael Zanetti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Autopilot
Incomplete
Medium
Unassigned

Bug Description

With unity next, when a test fails, autopilot prints the following traceback and stops executing further tests. From what I've understood from this trace is that it ties to collect the applications debug print and bails out when there are non base ascii characters in it.

Traceback (most recent call last):
  File "/usr/bin/autopilot", line 317, in <module>
    main()
  File "/usr/bin/autopilot", line 297, in main
    run_tests(args)
  File "/usr/bin/autopilot", line 161, in run_tests
    success = runner.run(test_suite).wasSuccessful()
  File "/usr/bin/autopilot", line 227, in run
    return test.run(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 108, in run
    test(result)
  File "/usr/lib/python2.7/unittest/case.py", line 396, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/dist-packages/testscenarios/testcase.py", line 62, in run
    return super(TestWithScenarios, self).run(result)
  File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 517, in run
    return self.__RunTest(self, self.exception_handlers).run(result)
  File "/usr/lib/python2.7/dist-packages/testtools/runtest.py", line 74, in run
    return self._run_one(actual_result)
  File "/usr/lib/python2.7/dist-packages/testtools/runtest.py", line 88, in _run_one
    return self._run_prepared_result(ExtendedToOriginalDecorator(result))
  File "/usr/lib/python2.7/dist-packages/testtools/runtest.py", line 107, in _run_prepared_result
    handler(self.case, self.result, e)
  File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 493, in _report_failure
    result.addFailure(self, details=self.getDetails())
  File "/usr/lib/python2.7/dist-packages/testtools/testresult/real.py", line 513, in addFailure
    return self.decorated.addFailure(test, details=details)
  File "/usr/lib/python2.7/dist-packages/testtools/testresult/real.py", line 95, in addFailure
    self._err_details_to_string(test, err, details)))
  File "/usr/lib/python2.7/dist-packages/testtools/testresult/real.py", line 145, in _err_details_to_string
    return _details_to_str(details, special='traceback')
  File "/usr/lib/python2.7/dist-packages/testtools/testresult/real.py", line 679, in _details_to_str
    text = content.as_text().strip()
  File "/usr/lib/python2.7/dist-packages/testtools/content.py", line 78, in as_text
    return _u('').join(self.iter_text())
  File "/usr/lib/python2.7/dist-packages/testtools/content.py", line 103, in _iter_text
    for bytes in self.iter_bytes():
  File "/usr/lib/python2.7/dist-packages/testtools/content.py", line 82, in iter_bytes
    return self._get_bytes()
  File "/usr/lib/python2.7/dist-packages/testtools/content.py", line 197, in <lambda>
    return Content(UTF8_TEXT, lambda: [text.encode('utf8')])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 7531: ordinal not in range(128)

Revision history for this message
Michael Zanetti (mzanetti) wrote :

exporting LANG=C before executing the tests seems to work around the issue.

The machines showing this issue have a default of LANG=en_US.UTF-8

Changed in autopilot:
status: New → Triaged
Changed in autopilot:
milestone: none → 1.3
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Michael,

It's not clear to me exactly what's going on here - the stack trace doesn't appear to touch your test suite at all. It looks to me like the test is failing, but the failure message itself has unicode characters in it... but I've tried failing tests with unicode characters in them. I've also tried raising exceptions with unicode, and adding content to a test manually with unicode.... all with no luck.

Are you able to shed some light on this please?

Cheers,

Changed in autopilot:
status: Triaged → Incomplete
Revision history for this message
Michael Zanetti (mzanetti) wrote :

I haven't been able to reproduce this on my machine either but it happens in all our Jenkins VM's unless I use the beforementioned workaround.

So far I know that:
- The machines locale needs to be set to something UTF-8
- the produced error message needs to contain some extended ascii characters (>128)

To me it seems the error happens deeper down in python test tools. Not sure if autopilot passes some invalid characters or its actually a bug in the test tools.

If you really can't figure what's happening we can prepare a Jenkins VM where you can reproduce the issue for you.

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Michael,

OK - if you're able to prepare a VM so I can reproduce it, I'm pretty confident I should be able to fix this. I guess I need to know:

how to log in to the VM
which autopilot command you're using to run the test

Cheers,

Revision history for this message
Allan LeSage (allanlesage) wrote :

There's an example of a test which fails in this mode in ken-vandine's webapps suite:

bzr branch lp:~ken-vandine/gnome-control-center-signon/autopilot gcc-lp1154107
cd gcc-lp1154107/tests/autopilot
autopilot run gnome_control_center_signon.test_control_center_signon.ControlCenterTests.test_create_oauth2_account

I'll add a log.

Changed in autopilot:
milestone: 1.3 → 1.3.1
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Reducing importance since I cannot reproduce, and nobody seems to be affected by this anymore. If this bug affects you, please figure out how to reproduce it, and let me know!

Changed in autopilot:
importance: Critical → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.