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

Side by Side Diff: recipe_modules/file/examples/copy.py

Issue 2918463002: [recipe_modules/file] add real file module to engine. (Closed)
Patch Set: rebase Created 3 years, 6 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
(Empty)
1 # Copyright 2017 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file.
4
5 DEPS = [
6 "file",
7 "path",
8 ]
9
10
11 def RunSteps(api):
12 dest = api.path['start_dir'].join('some file')
13 data = 'Here is some text data'
14
15 api.file.write_text('write a file', dest, data)
16 api.file.copy('copy it', dest, api.path['start_dir'].join('new path'))
17 read_data = api.file.read_text(
18 'read it', api.path['start_dir'].join('new path'), test_data=data)
19
20 assert read_data == data, (read_data, data)
21
22 api.file.move('move it', api.path['start_dir'].join('new path'),
23 api.path['start_dir'].join('new new path'))
24
25 read_data = api.file.read_text(
26 'read it', api.path['start_dir'].join('new new path'), test_data=data)
27
28 assert read_data == data, (read_data, data)
29
30
31 def GenTests(api):
32 yield api.test('basic')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698