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

Unified Diff: scripts/slave/unittests/robust_tempdir_test.py

Issue 1879173003: annotated_run: extract robust_tempdir so it can be shared with kitchen_run (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: review Created 4 years, 8 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
« no previous file with comments | « scripts/slave/unittests/annotated_run_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/unittests/robust_tempdir_test.py
diff --git a/scripts/slave/unittests/robust_tempdir_test.py b/scripts/slave/unittests/robust_tempdir_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..896b3ea47060fd3502ee028db58a1755e70085d1
--- /dev/null
+++ b/scripts/slave/unittests/robust_tempdir_test.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import unittest
+
+import test_env # pylint: disable=W0403,W0611
+
+from slave import robust_tempdir
+
+
+class RobustTempdirTest(unittest.TestCase):
+ def test_empty(self):
+ with robust_tempdir.RobustTempdir(prefix='robust_tempdir_test'):
+ pass
+
+ def test_basic(self):
+ with robust_tempdir.RobustTempdir(prefix='robust_tempdir_test') as rt:
+ path = rt.tempdir()
+ self.assertTrue(os.path.exists(path))
+
+ self.assertFalse(os.path.exists(path))
+
+ def test_leak(self):
+ with robust_tempdir.RobustTempdir(
+ prefix='robust_tempdir_test', leak=True) as rt:
+ path = rt.tempdir()
+ self.assertTrue(os.path.exists(path))
+
+ self.assertTrue(os.path.exists(path))
+ os.rmdir(path)
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « scripts/slave/unittests/annotated_run_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698