| 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 24 matching lines...) Expand all Loading... |
| 35 import stat | 35 import stat |
| 36 import sys | 36 import sys |
| 37 import tempfile | 37 import tempfile |
| 38 import unittest | 38 import unittest |
| 39 | 39 |
| 40 from webkitpy.common.system.filesystem import FileSystem | 40 from webkitpy.common.system.filesystem import FileSystem |
| 41 | 41 |
| 42 | 42 |
| 43 class GenericFileSystemTests(object): | 43 class GenericFileSystemTests(object): |
| 44 """Tests that should pass on either a real or mock filesystem.""" | 44 """Tests that should pass on either a real or mock filesystem.""" |
| 45 # pylint gets confused about this being a mixin: pylint: disable=E1101 | 45 # Pylint gets confused about this being a mixin: pylint: disable=no-member |
| 46 | 46 |
| 47 def setup_generic_test_dir(self): | 47 def setup_generic_test_dir(self): |
| 48 fs = self.fs | 48 fs = self.fs |
| 49 self.generic_test_dir = str(self.fs.mkdtemp()) | 49 self.generic_test_dir = str(self.fs.mkdtemp()) |
| 50 self.orig_cwd = fs.getcwd() | 50 self.orig_cwd = fs.getcwd() |
| 51 fs.chdir(self.generic_test_dir) | 51 fs.chdir(self.generic_test_dir) |
| 52 fs.write_text_file('foo.txt', 'foo') | 52 fs.write_text_file('foo.txt', 'foo') |
| 53 fs.write_text_file('foobar', 'foobar') | 53 fs.write_text_file('foobar', 'foobar') |
| 54 fs.maybe_make_directory('foodir') | 54 fs.maybe_make_directory('foodir') |
| 55 fs.write_text_file(fs.join('foodir', 'baz'), 'baz') | 55 fs.write_text_file(fs.join('foodir', 'baz'), 'baz') |
| (...skipping 263 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 |