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

Unified Diff: recipe_modules/path/examples/full.py

Issue 2918463002: [recipe_modules/file] add real file module to engine. (Closed)
Patch Set: rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: recipe_modules/path/examples/full.py
diff --git a/recipe_modules/path/examples/full.py b/recipe_modules/path/examples/full.py
index d5d89a8a42c4bd0dd063a9a61147242148018fd1..330482f8e17fe782e23edb98e9945f6b1dc7cb21 100644
--- a/recipe_modules/path/examples/full.py
+++ b/recipe_modules/path/examples/full.py
@@ -55,6 +55,28 @@ def RunSteps(api):
api.path.mock_add_paths(home_path)
assert api.path.exists(home_path)
+ # can mock copy paths. See the file module to do this for real.
+ copy1 = api.path['start_dir'].join('copy1')
+ copy2 = api.path['start_dir'].join('copy2')
+ api.step('rm copy2 (initial)', ['rm', '-rf', copy2])
+
+ api.step('mkdirs', ['mkdir', '-p', copy1.join('foo', 'bar')])
+ api.path.mock_add_paths(copy1.join('foo', 'bar'))
+ api.step('cp copy1 copy2', ['cp', '-a', copy1, copy2])
+ api.path.mock_copy_paths(copy1, copy2)
+ assert api.path.exists(copy2.join('foo', 'bar'))
+
+ # can mock remove paths. See the file module to do this for real.
+ api.step('rm copy2/foo', ['rm', '-rf', copy2.join('foo')])
+ api.path.mock_remove_paths(str(copy2)+api.path.sep)
+ assert not api.path.exists(copy2.join('foo', 'bar'))
+ assert not api.path.exists(copy2.join('foo'))
+ assert api.path.exists(copy2)
+
+ api.step('rm copy2', ['rm', '-rf', copy2])
+ api.path.mock_remove_paths(copy2)
+ assert not api.path.exists(copy2)
+
# Convert strings to Paths
paths_to_convert = [
api.path['start_dir'].join('some', 'thing'),

Powered by Google App Engine
This is Rietveld 408576698