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

Issue 132022: Fix watchlists for windows, for files with backslash (Closed)

Created:
11 years, 6 months ago by Nirnimesh
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 8

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -0 lines) Patch
M tests/watchlists_unittest.py View 1 2 chunks +27 lines, -0 lines 0 comments Download
M watchlists.py View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Nirnimesh
11 years, 6 months ago (2009-06-18 17:56:03 UTC) #1
M-A Ruel
http://codereview.chromium.org/132022/diff/1/3 File watchlists.py (right): http://codereview.chromium.org/132022/diff/1/3#newcode113 Line 113: path = path.replace('\\', '/') path = path.replace(os.sep, '/') ...
11 years, 6 months ago (2009-06-18 18:05:28 UTC) #2
Nirnimesh
http://codereview.chromium.org/132022/diff/1/3 File watchlists.py (right): http://codereview.chromium.org/132022/diff/1/3#newcode113 Line 113: path = path.replace('\\', '/') On 2009/06/18 18:05:28, Marc-Antoine ...
11 years, 6 months ago (2009-06-18 18:10:22 UTC) #3
M-A Ruel
On 2009/06/18 18:10:22, Nirnimesh wrote: > http://codereview.chromium.org/132022/diff/1/3 > File watchlists.py (right): > > http://codereview.chromium.org/132022/diff/1/3#newcode113 > ...
11 years, 6 months ago (2009-06-18 18:13:31 UTC) #4
John Grabowski
LGTM with minor tweaks http://codereview.chromium.org/132022/diff/1/2 File tests/watchlists_unittest.py (right): http://codereview.chromium.org/132022/diff/1/2#newcode130 Line 130: def testWinPathWatchers(self): A unit ...
11 years, 6 months ago (2009-06-18 18:21:25 UTC) #5
Nirnimesh
I think this test is important to have. Yesterday darin discovered that watchlists for windows ...
11 years, 6 months ago (2009-06-18 18:22:31 UTC) #6
Nirnimesh
11 years, 6 months ago (2009-06-18 18:40:43 UTC) #7
http://codereview.chromium.org/132022/diff/1/2
File tests/watchlists_unittest.py (right):

http://codereview.chromium.org/132022/diff/1/2#newcode152
Line 152: ['chrome\\browser\\renderer_host\\render_widget_host.h']), watchers)
On 2009/06/18 18:21:25, John Grabowski wrote:
> Use this construct for "raw" strings so you don't need to double the
backslash:
>   r'rawstring'
> e.g.
> r'chrome\browser\blah'
> 

Done.

http://codereview.chromium.org/132022/diff/1/3
File watchlists.py (right):

http://codereview.chromium.org/132022/diff/1/3#newcode113
Line 113: path = path.replace('\\', '/')
On 2009/06/18 18:05:28, Marc-Antoine Ruel wrote:
> path = path.replace(os.sep, '/')
> 
> Works every time. No need to check for the platform.

Done.

http://codereview.chromium.org/132022/diff/1/3#newcode113
Line 113: path = path.replace('\\', '/')
On 2009/06/18 18:21:25, John Grabowski wrote:
> On 2009/06/18 18:10:22, Nirnimesh wrote:
> > On 2009/06/18 18:05:28, Marc-Antoine Ruel wrote:
> > > path = path.replace(os.sep, '/')
> > > 
> > > Works every time. No need to check for the platform.
> > 
> > But then how do I write the unit-test? I'd like to be able to run this test
> from
> > posix too.
> 
> Unlike maruel, I'd be quite happy to add a little complexity to improve
> testability.  However, in this case os.sep is a good idea.  For unit tests,
> simply redefine os.sep to be what you need.  E.g.
>   os.sep = r'\'
> (Yes it's that easy)
> 

Hmm.. I was worried that other tests would see a changed os.sep.
Anyways, I've saved a copy of os.sep and reverted back after this test.

Thanks

Powered by Google App Engine
This is Rietveld 408576698