| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import unittest |
| 8 |
| 9 import test_env # pylint: disable=W0403,W0611 |
| 10 |
| 11 from slave import robust_tempdir |
| 12 |
| 13 |
| 14 class RobustTempdirTest(unittest.TestCase): |
| 15 def test_empty(self): |
| 16 with robust_tempdir.RobustTempdir(prefix='robust_tempdir_test'): |
| 17 pass |
| 18 |
| 19 def test_basic(self): |
| 20 with robust_tempdir.RobustTempdir(prefix='robust_tempdir_test') as rt: |
| 21 path = rt.tempdir() |
| 22 self.assertTrue(os.path.exists(path)) |
| 23 |
| 24 self.assertFalse(os.path.exists(path)) |
| 25 |
| 26 def test_leak(self): |
| 27 with robust_tempdir.RobustTempdir( |
| 28 prefix='robust_tempdir_test', leak=True) as rt: |
| 29 path = rt.tempdir() |
| 30 self.assertTrue(os.path.exists(path)) |
| 31 |
| 32 self.assertTrue(os.path.exists(path)) |
| 33 os.rmdir(path) |
| 34 |
| 35 |
| 36 if __name__ == '__main__': |
| 37 unittest.main() |
| OLD | NEW |