Closed Bug 1272315 Opened 8 years ago Closed 8 years ago

mozunit prints failure assertions twice

Categories

(Firefox Build System :: General, defect)

44 Branch
defect
Not set
normal

Tracking

(firefox49 fixed)

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: dustin, Assigned: dustin)

References

Details

Attachments

(1 file)

If a test fails with mozunit, the entire assertion and traceback are printed twice, making interactive debugging quite difficult.
Also, something about its introspection fails:

TEST-UNEXPECTED-FAIL | NO TRACEBACK |
Error running mach:

    ['taskgraph', 'python-tests']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

AttributeError: 'NoneType' object has no attribute 'f_lineno'

  File "/home/dustin/p/m-c/taskcluster/mach_commands.py", line 62, in taskgraph_python_tests
    result = runner.run(suite)
  File "/home/dustin/p/m-c/config/mozunit.py", line 91, in run
    test(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/unittest/suite.py", line 108, in run
    test(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/unittest/suite.py", line 108, in run
    test(result)
  File "/usr/lib/python2.7/unittest/case.py", line 393, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/unittest/case.py", line 353, in run
    result.addError(self, sys.exc_info())
  File "/home/dustin/p/m-c/config/mozunit.py", line 64, in addError
    self.printFail(test, err)
  File "/home/dustin/p/m-c/config/mozunit.py", line 81, in printFail
    _f, _ln, _t = inspect.getframeinfo(tb)[:3]
  File "/usr/lib/python2.7/inspect.py", line 1005, in getframeinfo
    lineno = frame.f_lineno
TextTestRunner gives, for the same error,

======================================================================
ERROR: taskgraph.test.test_graph (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: taskgraph.test.test_graph
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/loader.py", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
    __import__(name)
  File "/home/dustin/p/m-c/build/mach_bootstrap.py", line 445, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/home/dustin/p/m-c/taskcluster/taskgraph/test/test_graph.py", line 44
SyntaxError: Non-ASCII character '\xce' in file /home/dustin/p/m-c/taskcluster/taskgraph/test/test_graph.py on line 44, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Assignee: nobody → dustin
Comment on attachment 8755894 [details]
MozReview Request: Bug 1272315: mozunit: log error message with line number only if available; r?glandium

https://reviewboard.mozilla.org/r/54866/#review51612

::: config/mozunit.py:76
(Diff revision 1)
>          self.stream.writeln("FAIL: {0}".format(self.getDescription(test)))
>          self.stream.writeln(self.failures[-1][1])
>  
>      def printFail(self, test, err):
>          exctype, value, tb = err
> +        message = value.message.split('\n')[0]

splitlines()
Attachment #8755894 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/cf196c79e5e5b22c35957c08e6d0b3d6fbc2b0e2
Bug 1272315: mozunit: log error message with line number only if available; r=glandium
https://hg.mozilla.org/mozilla-central/rev/cf196c79e5e5
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Depends on: 1278466
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: