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

Side by Side Diff: recipe_modules/path/examples/full.py

Issue 2988583002: [path] Fix root path mocking. (Closed)
Patch Set: use real paths Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « recipe_modules/path/api.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The LUCI Authors. All rights reserved. 1 # Copyright 2014 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 DEPS = [ 5 DEPS = [
6 'path', 6 'path',
7 'platform', 7 'platform',
8 'properties', 8 'properties',
9 'step', 9 'step',
10 ] 10 ]
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 file_path = api.path['tmp_base'].join('new_file') 50 file_path = api.path['tmp_base'].join('new_file')
51 abspath = api.path.abspath(file_path) 51 abspath = api.path.abspath(file_path)
52 api.path.assert_absolute(abspath) 52 api.path.assert_absolute(abspath)
53 53
54 api.step('touch me', ['touch', api.path.abspath(file_path)]) 54 api.step('touch me', ['touch', api.path.abspath(file_path)])
55 # Assert for testing that a file exists. 55 # Assert for testing that a file exists.
56 api.path.mock_add_paths(file_path) 56 api.path.mock_add_paths(file_path)
57 assert api.path.exists(file_path) 57 assert api.path.exists(file_path)
58 58
59 # Assert that we can mock filesystem paths.
60 root_path = ('C:\\Windows' if api.platform.is_win else '/bin')
61 api.path.mock_add_paths(root_path)
62 assert api.path.exists(root_path)
63
59 realpath = api.path.realpath(file_path) 64 realpath = api.path.realpath(file_path)
60 assert api.path.exists(realpath) 65 assert api.path.exists(realpath)
61 66
62 home_path = api.path.join(api.path.expanduser('~'), 'file') 67 home_path = api.path.join(api.path.expanduser('~'), 'file')
63 api.step('touch my home', ['touch', home_path]) 68 api.step('touch my home', ['touch', home_path])
64 api.path.mock_add_paths(home_path) 69 api.path.mock_add_paths(home_path)
65 assert api.path.exists(home_path) 70 assert api.path.exists(home_path)
66 71
67 # can mock copy paths. See the file module to do this for real. 72 # can mock copy paths. See the file module to do this for real.
68 copy1 = api.path['start_dir'].join('copy1') 73 copy1 = api.path['start_dir'].join('copy1')
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 yield (api.test('%s_luci' % platform) + 149 yield (api.test('%s_luci' % platform) +
145 api.platform.name(platform) + 150 api.platform.name(platform) +
146 api.properties(**{ 151 api.properties(**{
147 '$recipe_engine/path': { 152 '$recipe_engine/path': {
148 'cache_dir': '/c', 153 'cache_dir': '/c',
149 'temp_dir': '/t', 154 'temp_dir': '/t',
150 'cleanup_dir': '/build.dead', 155 'cleanup_dir': '/build.dead',
151 }, 156 },
152 }) + 157 }) +
153 api.path.exists(api.path['tmp_base'])) 158 api.path.exists(api.path['tmp_base']))
OLDNEW
« no previous file with comments | « recipe_modules/path/api.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698