| OLD | NEW |
| 1 # Copyright 2017 The LUCI Authors. All rights reserved. | 1 # Copyright 2017 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 "file", | 6 "file", |
| 7 "path", | 7 "path", |
| 8 ] | 8 ] |
| 9 | 9 |
| 10 | 10 |
| 11 def RunSteps(api): | 11 def RunSteps(api): |
| 12 file_names = ['a', 'aa', 'b', 'bb', 'c', 'cc'] | 12 file_names = ['a', 'aa', 'b', 'bb', 'c', 'cc'] |
| 13 | 13 |
| 14 dest = api.path['start_dir'].join('some dir') | 14 dest = api.path['start_dir'].join('some dir') |
| 15 api.file.ensure_directory('ensure "some dir"', dest) | 15 api.file.ensure_directory('ensure "some dir"', dest) |
| 16 for fname in file_names: | 16 for fname in file_names: |
| 17 api.file.write_text('write %s' % fname, dest.join(fname), fname) | 17 api.file.write_text('write %s' % fname, dest.join(fname), fname) |
| 18 api.file.filesizes('check filesizes', *file_names) |
| 18 | 19 |
| 19 dest2 = api.path['start_dir'].join('some other dir') | 20 dest2 = api.path['start_dir'].join('some other dir') |
| 20 api.file.rmtree('make sure dest is gone', dest2) | 21 api.file.rmtree('make sure dest is gone', dest2) |
| 21 api.file.copytree('copy it', dest, dest2) | 22 api.file.copytree('copy it', dest, dest2) |
| 22 | 23 |
| 23 paths = api.file.listdir('list new dir', dest2, file_names) | 24 paths = api.file.listdir('list new dir', dest2, file_names) |
| 24 assert paths == [dest2.join(n) for n in file_names], paths | 25 assert paths == [dest2.join(n) for n in file_names], paths |
| 25 | 26 |
| 26 paths = api.file.glob_paths('glob *a', dest2, '*a', ['a', 'aa']) | 27 paths = api.file.glob_paths('glob *a', dest2, '*a', ['a', 'aa']) |
| 27 assert paths == [dest2.join('a'), dest2.join('aa')], paths | 28 assert paths == [dest2.join('a'), dest2.join('aa')], paths |
| (...skipping 10 matching lines...) Expand all Loading... |
| 38 assert paths == [dest2.join(p) for p in ['aa', 'c', 'cc']], paths | 39 assert paths == [dest2.join(p) for p in ['aa', 'c', 'cc']], paths |
| 39 | 40 |
| 40 api.file.rmcontents('remove "some other dir/*"', dest2) | 41 api.file.rmcontents('remove "some other dir/*"', dest2) |
| 41 assert api.path.exists(dest2), dest2 | 42 assert api.path.exists(dest2), dest2 |
| 42 | 43 |
| 43 | 44 |
| 44 | 45 |
| 45 def GenTests(api): | 46 def GenTests(api): |
| 46 yield api.test('basic') | 47 yield api.test('basic') |
| 47 | 48 |
| OLD | NEW |