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

Issue 228323002: Use context manager to manage OS environment in tests (Closed)

Created:
6 years, 8 months ago by Nils Barth (inactive)
Modified:
6 years, 8 months ago
Reviewers:
Nico, Stefan Haller
CC:
gyp-developer_googlegroups.com
Base URL:
https://chromium.googlesource.com/external/gyp.git@master
Visibility:
Public.

Description

Use context manager to manage OS environment in tests Currently tests use manual context management (try: ... finally: ...) This is cleaner and more robust with a context manager: https://docs.python.org/2/library/contextlib.html Also fixes some bugs and typos. Tests are: test/cflags/gyptest-cflags.py (make + ninja) test/cxxflags/gyptest-cxxflags.py (ninja) R=thakis TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=make test/cflags/gyptest-cflags.py TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=ninja test/cflags/gyptest-cflags.py TEST=PYTHONPATH=$CHROMIUM_DIR/tools/gyp/test/lib TESTGYP_FORMAT=ninja test/cxxflags/gyptest-cxxflags.py r1893

Patch Set 1 #

Total comments: 4

Patch Set 2 : use try...finally #

Patch Set 3 : Remove unused imports #

Patch Set 4 : Revised docs and which build #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -87 lines) Patch
M test/cflags/gyptest-cflags.py View 1 2 3 3 chunks +15 lines, -55 lines 0 comments Download
M test/cxxflags/gyptest-cxxflags.py View 1 2 3 2 chunks +11 lines, -31 lines 0 comments Download
M test/lib/TestGyp.py View 1 3 chunks +17 lines, -1 line 0 comments Download

Messages

Total messages: 21 (0 generated)
Nils Barth (inactive)
Hi Nico, When looking up how GYP handles compiler options, I noticed this cleanup possibility. ...
6 years, 8 months ago (2014-04-08 08:56:32 UTC) #1
Nico
lgtm! (I think this code was written before contextmanagers existed in python, or at least ...
6 years, 8 months ago (2014-04-08 15:35:12 UTC) #2
Stefan Haller
https://codereview.chromium.org/228323002/diff/1/test/lib/TestGyp.py File test/lib/TestGyp.py (right): https://codereview.chromium.org/228323002/diff/1/test/lib/TestGyp.py#newcode55 test/lib/TestGyp.py:55: yield Sorry for jumping in here: for correctness, this ...
6 years, 8 months ago (2014-04-08 17:05:40 UTC) #3
Nils Barth (inactive)
Thanks Stefan! https://codereview.chromium.org/228323002/diff/1/test/lib/TestGyp.py File test/lib/TestGyp.py (right): https://codereview.chromium.org/228323002/diff/1/test/lib/TestGyp.py#newcode55 test/lib/TestGyp.py:55: yield On 2014/04/08 17:05:41, Stefan Haller wrote: ...
6 years, 8 months ago (2014-04-09 03:09:18 UTC) #4
Nils Barth (inactive)
One note: the cxxflags test *failed* (for make) once I corrected it to actually reset ...
6 years, 8 months ago (2014-04-09 05:58:24 UTC) #5
Nils Barth (inactive)
The CQ bit was checked by nbarth@chromium.org
6 years, 8 months ago (2014-04-09 05:58:43 UTC) #6
Nils Barth (inactive)
The CQ bit was unchecked by nbarth@chromium.org
6 years, 8 months ago (2014-04-09 05:58:46 UTC) #7
Nils Barth (inactive)
The CQ bit was checked by nbarth@chromium.org
6 years, 8 months ago (2014-04-09 06:00:19 UTC) #8
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-09 06:05:16 UTC) #9
commit-bot: I haz the power
Commit queue rejected this change because it did not recognize the base URL. Please commit ...
6 years, 8 months ago (2014-04-09 06:05:17 UTC) #10
Nils Barth (inactive)
Actually Nico, looks like CQ doesn't like this; could you commit yourself, unless I should ...
6 years, 8 months ago (2014-04-09 06:08:23 UTC) #11
Nico
On 2014/04/09 05:58:24, Nils Barth wrote: > One note: > the cxxflags test *failed* (for ...
6 years, 8 months ago (2014-04-09 17:50:06 UTC) #12
Nico
On 2014/04/09 06:08:23, Nils Barth wrote: > Actually Nico, looks like CQ doesn't like this; ...
6 years, 8 months ago (2014-04-09 17:50:28 UTC) #13
Nils Barth (inactive)
On 2014/04/09 17:50:28, Nico wrote: > The cq doesn't work for gyp, hence me asking ...
6 years, 8 months ago (2014-04-10 00:44:31 UTC) #14
Nils Barth (inactive)
On 2014/04/09 17:50:06, Nico wrote: > > This is because make apparently needs the same ...
6 years, 8 months ago (2014-04-10 00:46:20 UTC) #15
Nico
r1893
6 years, 8 months ago (2014-04-10 21:47:32 UTC) #16
scottmg
On 2014/04/10 21:47:32, Nico wrote: > r1893 It looks like this broke test\cxxflags\gyptest-cxxflags.py on windows.
6 years, 8 months ago (2014-04-10 23:22:30 UTC) #17
Nils Barth (inactive)
On 2014/04/10 21:47:32, Nico wrote: > r1893 Thanks!
6 years, 8 months ago (2014-04-11 02:22:59 UTC) #18
Nils Barth (inactive)
On 2014/04/10 23:22:30, scottmg wrote: > On 2014/04/10 21:47:32, Nico wrote: > > r1893 > ...
6 years, 8 months ago (2014-04-11 02:28:01 UTC) #19
Nils Barth (inactive)
Concretely, would you like to: 1. Apply a CL moving build into the environment (should ...
6 years, 8 months ago (2014-04-11 02:30:08 UTC) #20
Nils Barth (inactive)
6 years, 8 months ago (2014-04-11 02:43:12 UTC) #21
Message was sent while issue was closed.
On 2014/04/11 02:30:08, Nils Barth wrote:
> Concretely, would you like to:
> 1. Apply a CL moving build into the environment (should fix test)
> 2. Revert this CL
> 3. Investigate Linux/Windows behavior difference yourselves?
> 
> #1 is probably easiest, but maybe you want to look into this more?

I've posted a CL doing #1 (modify test so should pass on ninja-Windows):
Change cxxflags test to build in same env as gyp (+ test make and ninja)
https://codereview.chromium.org/233713003/

...in case this is the solution we want.

Powered by Google App Engine
This is Rietveld 408576698