Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Issue 2474003002: webkitpy: Don't fail if importing a port fails. (Closed)

Created:
4 years, 1 month ago by mithro
Modified:
3 years, 10 months ago
CC:
chromium-reviews, blink-reviews, djd-OOO-Apr2017, mcgreevy_go
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

webkitpy: Don't fail if importing a port fails. This makes it easier to run the layout tests on swarming. Currently if running on Linux or Mac you still need all the extra Android dependencies installed otherwise the whole script fails. This patch allows importing the Android "port" to fail when it isn't in use. BUG=524758

Patch Set 1 #

Patch Set 2 : webkitpy: Don't fail if importing a port fails. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -1 line) Patch
M third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/factory.py View 2 chunks +7 lines, -1 line 0 comments Download

Messages

Total messages: 12 (6 generated)
mithro
Hi! This is a small tweak for helping with running layout tests on swarming. Without ...
4 years, 1 month ago (2016-11-03 11:23:52 UTC) #2
Dirk Pranke
+jbudorick I think the goal is good, but I'm unsure about the implementation. Specifically, I'm ...
4 years, 1 month ago (2016-11-03 18:59:39 UTC) #8
jbudorick
On 2016/11/03 18:59:39, Dirk Pranke wrote: > +jbudorick > > I think the goal is ...
4 years, 1 month ago (2016-11-03 19:07:43 UTC) #9
mithro
On 2016/11/03 19:07:43, jbudorick wrote: > On 2016/11/03 18:59:39, Dirk Pranke wrote: > > +jbudorick ...
4 years, 1 month ago (2016-11-04 02:23:18 UTC) #10
Dirk Pranke
On 2016/11/04 02:23:18, mithro wrote: > On 2016/11/03 19:07:43, jbudorick wrote: > > On 2016/11/03 ...
4 years, 1 month ago (2016-11-04 17:21:12 UTC) #11
jbudorick
4 years, 1 month ago (2016-11-04 21:15:29 UTC) #12
On 2016/11/04 02:23:18, mithro wrote:
> On 2016/11/03 19:07:43, jbudorick wrote:
> > On 2016/11/03 18:59:39, Dirk Pranke wrote:
> > > +jbudorick
> > > 
> > > I think the goal is good, but I'm unsure about the implementation.
> 
> By the implementation, you mean the try/except around the import or only
> importing the targets as needed?
> 
> The big problem with the try/except is that if you are working on the android
> code and do something accidently to break the import (IE import an unavaliable
> module or spell the module name wrong) it might take a long time to debug.
> 
> > > Specifically, I'm concerned about how changing the default logic might
> affect
> > > some of the code coverage, particularly for test-webkitpy
> > (webkit_python_tests).
> > > 
> > > I also wonder whether this would break the mock-android port, which would
be
> > > bad.
> > > 
> > > I'm fine with changing the import logic if neither of the above things are
> > > affected. If they are, I'd like to find a different approach (maybe not
> > > importing devil et al. until we know it's really needed)?
> 
> I'm 100% sure we can refactor this code to not need to import all the modules.
> However, I don't really understand this code and it seems *very* unusual. 
> 
> How can I test things like the mock-android port or the code coverage stuff?
> 
> > > As to the implementation, I don't know that I would use the warnings
> > module. I
> > > haven't actually used that myself, but it looks like it's mostly used for
> > > warning about things that are deprecated in Python (that might be an issue
> for
> > > Python3, etc.)?
> > > 
> > > Generally speaking, I don't like warnings, because they are ignored or
> missed
> > > and lead to confusion. In most cases (and I think this is one of them),
> either
> > > they shouldn't produce a message at all because it's not a real problem,
or
> it
> > > should produce a real, user-friendly error and fail hard.
> 
> I generally agree with this idea.
> 
> FYI: I tried log.warning instead of the warning module. I went with warning
> because it just prints the first time rather than every time. The log.warning
> method *also* has all the same problems you listed, so it isn't really an
> alternative.
> 
> > I agree with all of this. I don't mind doing delayed imports of the devil
code
> > in port/android.py (and I already had to do it for the forwarder:
> >
>
https://codesearch.chromium.org/chromium/src/third_party/WebKit/Tools/Scripts...).
> 
> I worry slightly about delayed imports, they tend to cause a lot of subtle
bugs.
> Both the Python style guide and our style guide recommends against using them
> for this reason.
> 
> jbudorick@ are you working on the Android layout tests? At some point we will
> probably want to figure out how to isolate the Android port too, so maybe we
> just bite the bullet and do that now?

I am, yes, with the intention of making them work on newer versions w/ SELinux
on.

We definitely will want to isolate the Android port at some point, but I don't
have time to spend on doing so now.

> 
> Tim 'mithro' Ansell

Powered by Google App Engine
This is Rietveld 408576698