Open Bug 1525302 Opened 5 years ago Updated 2 years ago

"mach xpcshell-test" reports TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and 'file'

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

References

Details

(Keywords: in-triage)

runxpcshelltests.py imports print_function in an attempt to be forward-compatible with Python 3, but it still uses print as an operator instead of a function for writing messages to stderr. print >>sys.stderr results in a runtime error instead of a useful error message.

STR:

./mach xpcshell-test path/to/non/existent/test

Expected:

  • Some useful error message about the test being invalid.

Actual:

TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and 'file'

  File "/path/to/gecko/testing/xpcshell/mach_commands.py", line 260, in run_xpcshell_test
    return xpcshell.run_test(**params)
  File "/path/to/gecko/testing/xpcshell/mach_commands.py", line 60, in run_test
    return self.run_suite(**kwargs)
  File "/path/to/gecko/testing/xpcshell/mach_commands.py", line 46, in run_suite
    return self._run_xpcshell_harness(**kwargs)
  File "/path/to/gecko/testing/xpcshell/mach_commands.py", line 136, in _run_xpcshell_harness
    result = xpcshell.runTests(filtered_args)
  File "/path/to/gecko/testing/xpcshell/runxpcshelltests.py", line 1327, in runTests
    options.get('verify'))
  File "/path/to/gecko/testing/xpcshell/runxpcshelltests.py", line 890, in buildTestList
    mp = self.getTestManifest(self.manifest)
  File "/path/to/gecko/testing/xpcshell/runxpcshelltests.py", line 843, in getTestManifest
    print >> sys.stderr, ("Failed to find manifest at %s; use --manifest "

If you fix this, also consider fixing other instances of the problem in the codebase:
https://searchfox.org/mozilla-central/search?q=print+>>&case=false&regexp=true&path=.py

See Also: → 1551551
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.