Open Bug 1451465 Opened 2 years ago Updated 3 months ago

"mach marionette-test --emulator" fails with "TypeError: coercing to Unicode: need string or buffer, bool found"

Categories

(Testing :: Marionette, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: dev-prod-2020)

> mach marionette-test --emulator                                     1 ?
>  0:00.00 INFO Using workspace for temporary data: "/Volumes/data/code/gecko"
> Error running mach:
> 
>     ['marionette-test', '--emulator']
> 
> 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:
> 
> TypeError: coercing to Unicode: need string or buffer, bool found
> 
>   File "/Volumes/data/code/gecko/testing/marionette/mach_commands.py", line 89, in marionette_test
>     return run_marionette(tests, topsrcdir=self.topsrcdir, **kwargs)
>   File "/Volumes/data/code/gecko/testing/marionette/mach_commands.py", line 65, in run_marionette
>     failed = MarionetteHarness(MarionetteTestRunner, args=vars(args)).run()
>   File "/Volumes/data/code/gecko/testing/marionette/harness/marionette_harness/runtests.py", line 74, in run
>     runner.run_tests(tests)
>   File "/Volumes/data/code/gecko/testing/marionette/harness/marionette_harness/runner/base.py", line 857, in run_tests
>     self.marionette = self.driverclass(**self._build_kwargs())
>   File "/Volumes/data/code/gecko/testing/marionette/client/marionette_driver/marionette.py", line 619, in __init__
>     app, host=self.host, port=self.port, bin=self.bin, **instance_args)
>   File "/Volumes/data/code/gecko/testing/marionette/client/marionette_driver/geckoinstance.py", line 290, in create
>     app_id = mozversion.get_version(binary=kwargs["bin"])["application_id"]
>   File "/Volumes/data/code/gecko/testing/mozbase/mozversion/mozversion/mozversion.py", line 198, in get_version
>     if binary and zipfile.is_zipfile(binary) and 'AndroidManifest.xml' in \
>   File "/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 152, in is_zipfile
>     with open(filename, "rb") as fp:

The problem here is that mozversion gets a binary, but this is not a string but `True`. It's getting set in base.py:

https://dxr.mozilla.org/mozilla-central/rev/00bdc9451be6557ccce1492b9b966d4435615380/testing/marionette/harness/marionette_harness/runner/base.py#738-739

The code was added by:

> b6c77cd3400e Bug 787203 - Add emulator and Fennec support to Marionette harness and client; r=automatedtester
> Maja Frydrychowicz <mjzffr@gmail.com>

I'm sure that at this time everything was working, so something might have broken it in-between.
Priority: -- → P3
One solution could be to only execute the mozversion call if `kwargs["bin"]` is of type `basestring`, and remove the check for `None`.
Maybe my patch from bug 1322721 was not sufficient enough.
I'd want to run a marionette test locally, is there any alternative way to run a marionette test?
Not sure if this bug is valid anymore. I ran at least some Marionette tests on my phone via the marionette CLI directly. You would have to change into the virtualenv before running the command. All details for running the tests on Android can be found here:

https://firefox-source-docs.mozilla.org/testing/marionette/marionette/Testing.html#android
Whiteboard: dev-prod-2020

Note that on bug 1607210 we consider to remove mobile support from marionette harness because it won't be used with GeckoView applications. For those we have geckodriver available, which is utilized by various tools like browsertime already. So this bug might become invalid.

Depends on: 1607210
You need to log in before you can comment on or make changes to this bug.