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

Side by Side Diff: recipe_modules/file/example.disable

Issue 2993713003: Add file.filesizes to recipe engine core modules. (Closed)
Patch Set: update expectations Created 3 years, 4 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from recipe_engine.types import freeze 5 from recipe_engine.types import freeze
6 6
7 DEPS = [ 7 DEPS = [
8 'depot_tools/infra_paths', 8 'depot_tools/infra_paths',
9 'file', 9 'file',
10 'recipe_engine/path', 10 'recipe_engine/path',
(...skipping 16 matching lines...) Expand all
27 def RunSteps(api): 27 def RunSteps(api):
28 # listdir demo. 28 # listdir demo.
29 result = api.file.listdir('fake dir', '/fake/dir') 29 result = api.file.listdir('fake dir', '/fake/dir')
30 for element in result: 30 for element in result:
31 api.step('manipulate %s' % str(element), ['some', 'command']) 31 api.step('manipulate %s' % str(element), ['some', 'command'])
32 32
33 result = api.file.listdir('other', '/faker/dir') 33 result = api.file.listdir('other', '/faker/dir')
34 for element in result: 34 for element in result:
35 api.step('manipulate %s' % str(element), ['some', 'command']) 35 api.step('manipulate %s' % str(element), ['some', 'command'])
36 36
37 # filesizes demo.
38 filepaths = ['/fake/one', '/fake/other']
39 sizes = api.file.filesizes('filesizes', filepaths)
40 for f, s in zip(filepaths, sizes):
41 api.step('filesize of %s is %d bytes' % (f, s))
42
37 # mkdtemp demo. 43 # mkdtemp demo.
38 for prefix in ('prefix_a', 'prefix_b'): 44 for prefix in ('prefix_a', 'prefix_b'):
39 # Create temp dir. 45 # Create temp dir.
40 temp_dir = api.path.mkdtemp(prefix) 46 temp_dir = api.path.mkdtemp(prefix)
41 assert api.path.exists(temp_dir) 47 assert api.path.exists(temp_dir)
42 # Make |temp_dir| surface in expectation files. 48 # Make |temp_dir| surface in expectation files.
43 api.step('print %s' % prefix, ['echo', temp_dir]) 49 api.step('print %s' % prefix, ['echo', temp_dir])
44 50
45 # move demo 51 # move demo
46 api.file.move( 52 api.file.move(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 'glob', tmp_dir.join('*'), 91 'glob', tmp_dir.join('*'),
86 test_data=[tmp_dir.join('dummy_file')]) 92 test_data=[tmp_dir.join('dummy_file')])
87 assert files == [tmp_dir.join('dummy_file')], files 93 assert files == [tmp_dir.join('dummy_file')], files
88 94
89 finally: 95 finally:
90 api.file.rmtree('cleanup', tmp_dir) 96 api.file.rmtree('cleanup', tmp_dir)
91 api.file.rmtree('cleanup2', new_tmp) 97 api.file.rmtree('cleanup2', new_tmp)
92 98
93 99
94 def GenTests(api): 100 def GenTests(api):
95 yield api.test('file_io') + api.file.listdir('other', ['aaa']) 101 yield (api.test('file_io')
96 102 + api.file.listdir('other', ['aaa'])
103 + api.file.filesizes([1, 44]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698