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

Unified Diff: recipe_modules/file/examples/error.py

Issue 2918463002: [recipe_modules/file] add real file module to engine. (Closed)
Patch Set: fix rmtree 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/file/examples/error.py
diff --git a/recipe_modules/file/examples/error.py b/recipe_modules/file/examples/error.py
new file mode 100644
index 0000000000000000000000000000000000000000..e625fe747dcd56aa9c445231654071d0f8d39ea6
--- /dev/null
+++ b/recipe_modules/file/examples/error.py
@@ -0,0 +1,24 @@
+# Copyright 2017 The LUCI Authors. All rights reserved.
+# Use of this source code is governed under the Apache License, Version 2.0
+# that can be found in the LICENSE file.
+
+DEPS = [
+ "file",
+ "path",
+]
+
+
+def RunSteps(api):
+ try:
+ api.file.read_text(
+ 'does not exist', api.path['start_dir'].join('not_there'))
+ assert False, "never reached" # pragma: no cover
+ except api.file.Error as e:
+ assert e.errno_name == 'ENOENT'
+
+
+def GenTests(api):
+ yield (
+ api.test('basic')
+ + api.step_data('does not exist', api.file.errno('ENOENT'))
+ )

Powered by Google App Engine
This is Rietveld 408576698