| OLD | NEW |
| 1 # vim: set fileencoding=utf-8 : | 1 # vim: set fileencoding=utf-8 : |
| 2 # Copyright (C) 2010 Google Inc. All rights reserved. | 2 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 # Clean up. | 231 # Clean up. |
| 232 os.rmdir(sub_path) | 232 os.rmdir(sub_path) |
| 233 | 233 |
| 234 self.assertFalse(os.path.exists(base_path)) | 234 self.assertFalse(os.path.exists(base_path)) |
| 235 self.assertFalse(fs.isdir(base_path)) | 235 self.assertFalse(fs.isdir(base_path)) |
| 236 | 236 |
| 237 def test_maybe_make_directory__failure(self): | 237 def test_maybe_make_directory__failure(self): |
| 238 # FIXME: os.chmod() doesn't work on Windows to set directories | 238 # FIXME: os.chmod() doesn't work on Windows to set directories |
| 239 # as readonly, so we skip this test for now. | 239 # as readonly, so we skip this test for now. |
| 240 if sys.platform in ('win32', 'cygwin'): | 240 if sys.platform == 'win32': |
| 241 return | 241 return |
| 242 | 242 |
| 243 fs = FileSystem() | 243 fs = FileSystem() |
| 244 with fs.mkdtemp(prefix='filesystem_unittest_') as d: | 244 with fs.mkdtemp(prefix='filesystem_unittest_') as d: |
| 245 # Remove write permissions on the parent directory. | 245 # Remove write permissions on the parent directory. |
| 246 os.chmod(d, stat.S_IRUSR) | 246 os.chmod(d, stat.S_IRUSR) |
| 247 | 247 |
| 248 # Now try to create a sub directory - should fail. | 248 # Now try to create a sub directory - should fail. |
| 249 sub_dir = fs.join(d, 'subdir') | 249 sub_dir = fs.join(d, 'subdir') |
| 250 self.assertRaises(OSError, fs.maybe_make_directory, sub_dir) | 250 self.assertRaises(OSError, fs.maybe_make_directory, sub_dir) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 fs = FileSystem() | 319 fs = FileSystem() |
| 320 self.assertTrue(fs.remove('filename', remove_with_exception)) | 320 self.assertTrue(fs.remove('filename', remove_with_exception)) |
| 321 self.assertEqual(-1, RealFileSystemTest._remove_failures) | 321 self.assertEqual(-1, RealFileSystemTest._remove_failures) |
| 322 | 322 |
| 323 def test_sep(self): | 323 def test_sep(self): |
| 324 fs = FileSystem() | 324 fs = FileSystem() |
| 325 | 325 |
| 326 self.assertEqual(fs.sep, os.sep) | 326 self.assertEqual(fs.sep, os.sep) |
| 327 self.assertEqual(fs.join('foo', 'bar'), | 327 self.assertEqual(fs.join('foo', 'bar'), |
| 328 os.path.join('foo', 'bar')) | 328 os.path.join('foo', 'bar')) |
| OLD | NEW |