ImportError: cannot import name '_ExpectedFailure'
Categories
(Remote Protocol :: Marionette, defect, P3)
Tracking
(firefox78 fixed)
Tracking | Status | |
---|---|---|
firefox78 | --- | fixed |
People
(Reporter: rgpt, Assigned: bc)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0
Steps to reproduce:
Attempt to run marionette-test from python3
$ python3 mach marionette-test
Actual results:
ImportError: cannot import name '_ExpectedFailure'
File "/home/rgpt/Desktop/mozilla/mozilla-unified/python/mach/mach/main.py", line 360, in run
return self._run(argv)
File "/home/rgpt/Desktop/mozilla/mozilla-unified/python/mach/mach/main.py", line 415, in _run
args = parser.parse_args(argv)
File "/usr/lib/python3.5/argparse.py", line 1735, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "/usr/lib/python3.5/argparse.py", line 1767, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "/usr/lib/python3.5/argparse.py", line 1976, in _parse_known_args
stop_index = consume_positionals(start_index)
File "/usr/lib/python3.5/argparse.py", line 1932, in consume_positionals
take_action(action, args)
File "/usr/lib/python3.5/argparse.py", line 1841, in take_action
action(self, namespace, argument_values, option_string)
File "/home/rgpt/Desktop/mozilla/mozilla-unified/python/mach/mach/dispatcher.py", line 179, in call
if handler.parser:
File "/home/rgpt/Desktop/mozilla/mozilla-unified/python/mach/mach/decorators.py", line 77, in parser
self._parser = self._parser()
File "/home/rgpt/Desktop/mozilla/mozilla-unified/testing/marionette/mach_commands.py", line 24, in create_parser_tests
from marionette_harness.runtests import MarionetteArguments
File "/home/rgpt/Desktop/mozilla/mozilla-unified/build/mach_bootstrap.py", line 431, in call
module = self._original_import(name, globals, locals, fromlist, level)
File "/home/rgpt/Desktop/mozilla/mozilla-unified/build/mach_bootstrap.py", line 431, in call
module = self._original_import(name, globals, locals, fromlist, level)
File "/home/rgpt/Desktop/mozilla/mozilla-unified/testing/marionette/harness/marionette_harness/init.py", line 9, in <module>
from .marionette_test import (
File "/home/rgpt/Desktop/mozilla/mozilla-unified/build/mach_bootstrap.py", line 431, in call
module = self._original_import(name, globals, locals, fromlist, level)
File "/home/rgpt/Desktop/mozilla/mozilla-unified/testing/marionette/harness/marionette_harness/marionette_test/init.py", line 27, in <module>
from .testcases import (
File "/home/rgpt/Desktop/mozilla/mozilla-unified/build/mach_bootstrap.py", line 431, in call
module = self._original_import(name, globals, locals, fromlist, level)
File "/home/rgpt/Desktop/mozilla/mozilla-unified/testing/marionette/harness/marionette_harness/marionette_test/testcases.py", line 17, in <module>
from unittest.case import (
Expected results:
marionette tests should have started running seamlessly.
Comment 1•6 years ago
|
||
Rishi, thank you for filing this issue! It is indeed a blocker for us to move Marionette over to Python3. Would you also be interested to work on this bug? If yes, what would be your first steps?
Updated•6 years ago
|
Reporter | ||
Comment 2•6 years ago
|
||
Yes whimboo, I am interested in working on this bug. I would try make marionette harness work with py3 so as to keep it compatible with py2 so marionette test on py2 are not affected
Comment 3•6 years ago
|
||
Great. So it's reserved for you. Let me know when you need help.
Reporter | ||
Comment 4•6 years ago
|
||
Based on the search It seems _ExpectedFailure
Exception Class is removed from python3 unittest . And, as it was a internal variable it was not mentioned in the py3 porting guide.
_ExpectedFailure is only being used to raise an exception and call expected_failure
after catching the exception. (as mentioned in the snippet below) Which could be directly called without raising an exception. The reason we could do that is because _ExpectedFailure is not being raised from anywhere testing module, but this (testcases.py) file
Another Solution
would be create our custom Exception to mimic the one python2.7 and follow the same for both py2 and py3
@whimboo what should be the preferred course of action ?
IN : mozilla-unified/testing/marionette/harness/marionette_harness/marionette_test/testcases.py
try:
if self.expected == "fail":
try:
self.setUp()
except Exception:
raise _ExpectedFailure(sys.exc_info())
else:
self.setUp()
except SkipTest as e:
self._addSkip(result, str(e))
except (KeyboardInterrupt, UnresponsiveInstanceException):
raise
except _ExpectedFailure as e:
expected_failure(result, e.exc_info)
except Exception:
self._enter_pm()
result.addError(self, sys.exc_info())
```
Comment 5•6 years ago
|
||
Could you please check how _ExpectedFailure is implemented in Python2? If it's just some lines of code we could indeed just add it to our file.
Reporter | ||
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Both newly filed bugs shouldn't actually block this bug from getting landed but bug 1355537 instead.
Reporter | ||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 9•6 years ago
|
||
Backed out changeset a3b107922e81 (bug 1595814) for causing marionette perma failures
push that caused the backout: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&revision=a3b107922e813e7930c6673095acfd146c305668
backout: https://hg.mozilla.org/integration/autoland/rev/01d092f87acb2d360caf147c802bb10932734d5e
Reporter | ||
Updated•6 years ago
|
Comment 10•5 years ago
|
||
Rishi, it looks like this bug got under the wire and I completely missed to reply in regards of the backout. I wonder if you are still interested to work on it? Please let me know. Thanks a lot.
Comment 11•5 years ago
|
||
Hm, ok. I assume not. Opening up this bug for others to pick up.
Comment 12•5 years ago
|
||
Hi i would like to work on this if its still open?
Comment 13•5 years ago
|
||
Hi rcrahul60. Thank you for your interest, but I have to admit that I missed to remove this bug from the mentored list given that it will be too hard to get fixed for someone new on the code base. We have plenty of other bugs, so maybe you can find something else?
Otherwise if you are an experienced Python developer and have knowledge with Python3 feel free to pick it up.
Thanks.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 14•5 years ago
|
||
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
bugherder |
Updated•3 years ago
|
Description
•