mach fails to run mochitests: 'TypeError: __init__() takes at most 2 arguments (3 given)'

RESOLVED FIXED in mozilla25

Status

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: ttaubert, Assigned: ahal)

Tracking

({regression})

Trunk
mozilla25
regression
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [mach])

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
TypeError: __init__() takes at most 2 arguments (3 given)

  File "/home/tim/workspace/fx-team/testing/mochitest/mach_commands.py", line 280, in run_mochitest_browser
    return self.run_mochitest(test_file, 'browser', **kwargs)
  File "/home/tim/workspace/fx-team/testing/mochitest/mach_commands.py", line 299, in run_mochitest
    **kwargs)
  File "/home/tim/workspace/fx-team/testing/mochitest/mach_commands.py", line 111, in run_mochitest_test
    opts = mochitest.MochitestOptions(automation, tests_dir)

This happens with fx-team tip (i.e. m-c tip as of now).
(Reporter)

Comment 1

5 years ago
Caused by bug 865349.
Blocks: 865349
Keywords: regression
mochitest_options.py is a new file added by bug 865349.  The MochitestOptions class was moved from runtests.py and put in this new file, but in the process lost its second positional arg, scriptdir.  The removal of this param causes the issue.

If you hack things to get past this, the next problem I have on Windows is:

===
The details of the failure are as follows:

TypeError: environment can only contain strings

  File "o:\src\mm\mozilla-hg\mc-socialapi-landing\testing/mochitest/mach_commands.py", line 282, in run_mochitest_browser
...

  File "o:\src\mm\mozilla-hg\mc-socialapi-landing/obj-release\_tests\testing\mochitest\runtests.py", line 90, in start
    self._process = self._automation.Process([xpcshell] + args, env = env)
  File "o:\src\mm\mozilla-hg\mc-socialapi-landing/obj-release\build\automation.py", line 201, in __init__
===

The problem here is that the PATH key of env is unicode.  This is as far as I got.
OS: Linux → All
Hardware: x86_64 → All
(Assignee)

Comment 3

5 years ago
This is because I removed the dependency from automation.py in the options class. Sorry, should have thought to update the mach runner at the same time. Patch coming shortly.
Status: NEW → ASSIGNED
QA Contact: ahalberstadt
(Assignee)

Comment 4

5 years ago
(In reply to Mark Hammond (:markh) from comment #2)
> If you hack things to get past this, the next problem I have on Windows is:
> 
> ===
> The details of the failure are as follows:
> 
> TypeError: environment can only contain strings
> 
>   File
> "o:\src\mm\mozilla-hg\mc-socialapi-landing\testing/mochitest/mach_commands.
> py", line 282, in run_mochitest_browser
> ...
> 
>   File
> "o:\src\mm\mozilla-hg\mc-socialapi-landing/obj-
> release\_tests\testing\mochitest\runtests.py", line 90, in start
>     self._process = self._automation.Process([xpcshell] + args, env = env)
>   File
> "o:\src\mm\mozilla-hg\mc-socialapi-landing/obj-release\build\automation.py",
> line 201, in __init__
> ===
> 
> The problem here is that the PATH key of env is unicode.  This is as far as
> I got.

So this used to work prior to bug 865349? I'm not really sure what I could have changed that would cause the env to be in unicode..
(Assignee)

Updated

5 years ago
Duplicate of this bug: 898805
(Assignee)

Comment 6

5 years ago
Created attachment 782598 [details] [diff] [review]
Patch 1.0 - fix __init__ error

This will fix the init problem, and adds an mpl header.
Assignee: nobody → ahalberstadt
Attachment #782598 - Flags: review?(jgriffin)
(Assignee)

Updated

5 years ago
QA Contact: ahalberstadt
I am getting a different error:

http://pastebin.mozilla.org/2737950

  File "_tests/testing/mochitest/runtests.py", line 178, in __init__
    mozinfo.find_and_update_from_json(SCRIPT_DIR)
AttributeError: 'module' object has no attribute 'find_and_update_from_json'

Should I open a different bug? If I backout the patch from bug 865349 I am not getting any errors.

I'm using Ubuntu 12.04 LTS, Python 2.7.3.
Attachment #782598 - Flags: review?(jgriffin) → review+
(In reply to Mihai Sucan [:msucan] from comment #7)
> I am getting a different error:
> 
> http://pastebin.mozilla.org/2737950
> 
>   File "_tests/testing/mochitest/runtests.py", line 178, in __init__
>     mozinfo.find_and_update_from_json(SCRIPT_DIR)
> AttributeError: 'module' object has no attribute 'find_and_update_from_json'
> 
> Should I open a different bug? If I backout the patch from bug 865349 I am
> not getting any errors.
> 
> I'm using Ubuntu 12.04 LTS, Python 2.7.3.

That method was added in http://hg.mozilla.org/mozilla-central/rev/a13dafd65d1c; the error suggests you're picking up an old version of mozinfo.py.  You might try removing your virtualenv (/home/mihai/Public/builds/firefox/fx-team/browser-opt/_virtualenv), and re-building.
(Assignee)

Comment 9

5 years ago
(In reply to Mihai Sucan [:msucan] from comment #7)
> I am getting a different error:
> 
> http://pastebin.mozilla.org/2737950
> 
>   File "_tests/testing/mochitest/runtests.py", line 178, in __init__
>     mozinfo.find_and_update_from_json(SCRIPT_DIR)
> AttributeError: 'module' object has no attribute 'find_and_update_from_json'
> 
> Should I open a different bug? If I backout the patch from bug 865349 I am
> not getting any errors.
> 
> I'm using Ubuntu 12.04 LTS, Python 2.7.3.

Alternatively if you use mach to run the mochitests it should pick up the correct in-tree versions of mozbase for you.
Bugs with mach commands go in the component providing the mach command.
Component: mach → Mochitest
Product: Core → Testing
Whiteboard: [mach]
(Assignee)

Comment 11

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/f18ba2a7e24c

Mark, do you think your env problem is related to the patch in bug 865349? If so, lets file a separate bug for that issue.
Flags: needinfo?(mhammond)
(In reply to Andrew Halberstadt [:ahal] from comment #11)
> https://hg.mozilla.org/integration/mozilla-inbound/rev/f18ba2a7e24c
> 
> Mark, do you think your env problem is related to the patch in bug 865349?
> If so, lets file a separate bug for that issue.

It looks like bug 898903.
Duplicate of this bug: 899568
https://hg.mozilla.org/mozilla-central/rev/f18ba2a7e24c
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
(In reply to Andrew Halberstadt [:ahal] from comment #11)
> https://hg.mozilla.org/integration/mozilla-inbound/rev/f18ba2a7e24c
> 
> Mark, do you think your env problem is related to the patch in bug 865349?

I think it was as backing out that patch caused everything to work fine.  However, now this fix has made it to m-c I no longer have any problems, so there's nothing else to do here - thanks!
Flags: needinfo?(mhammond)
You need to log in before you can comment on or make changes to this bug.