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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py

Issue 1839193004: Run auto-formatter (autopep8) on webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
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=E1101
46
46 def setup_generic_test_dir(self): 47 def setup_generic_test_dir(self):
47 fs = self.fs 48 fs = self.fs
48 self.generic_test_dir = str(self.fs.mkdtemp()) 49 self.generic_test_dir = str(self.fs.mkdtemp())
49 self.orig_cwd = fs.getcwd() 50 self.orig_cwd = fs.getcwd()
50 fs.chdir(self.generic_test_dir) 51 fs.chdir(self.generic_test_dir)
51 fs.write_text_file('foo.txt', 'foo') 52 fs.write_text_file('foo.txt', 'foo')
52 fs.write_text_file('foobar', 'foobar') 53 fs.write_text_file('foobar', 'foobar')
53 fs.maybe_make_directory('foodir') 54 fs.maybe_make_directory('foodir')
54 fs.write_text_file(fs.join('foodir', 'baz'), 'baz') 55 fs.write_text_file(fs.join('foodir', 'baz'), 'baz')
55 fs.chdir(self.orig_cwd) 56 fs.chdir(self.orig_cwd)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 self.fs.chdir(self.generic_test_dir) 129 self.fs.chdir(self.generic_test_dir)
129 self.fs.move('foo.txt', 'bar.txt') 130 self.fs.move('foo.txt', 'bar.txt')
130 self.assertFalse(self.fs.exists('foo.txt')) 131 self.assertFalse(self.fs.exists('foo.txt'))
131 self.assertTrue(self.fs.exists('bar.txt')) 132 self.assertTrue(self.fs.exists('bar.txt'))
132 self.fs.move('foodir', 'bardir') 133 self.fs.move('foodir', 'bardir')
133 self.assertFalse(self.fs.exists('foodir')) 134 self.assertFalse(self.fs.exists('foodir'))
134 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz'))) 135 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz')))
135 self.assertTrue(self.fs.exists('bardir')) 136 self.assertTrue(self.fs.exists('bardir'))
136 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz'))) 137 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz')))
137 138
139
138 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): 140 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests):
141
139 def setUp(self): 142 def setUp(self):
140 self.fs = FileSystem() 143 self.fs = FileSystem()
141 self.setup_generic_test_dir() 144 self.setup_generic_test_dir()
142 145
143 self._this_dir = os.path.dirname(os.path.abspath(__file__)) 146 self._this_dir = os.path.dirname(os.path.abspath(__file__))
144 self._missing_file = os.path.join(self._this_dir, 'missing_file.py') 147 self._missing_file = os.path.join(self._this_dir, 'missing_file.py')
145 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py') 148 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py')
146 149
147 def tearDown(self): 150 def tearDown(self):
148 self.teardown_generic_test_dir() 151 self.teardown_generic_test_dir()
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 319
317 fs = FileSystem() 320 fs = FileSystem()
318 self.assertTrue(fs.remove('filename', remove_with_exception)) 321 self.assertTrue(fs.remove('filename', remove_with_exception))
319 self.assertEqual(-1, RealFileSystemTest._remove_failures) 322 self.assertEqual(-1, RealFileSystemTest._remove_failures)
320 323
321 def test_sep(self): 324 def test_sep(self):
322 fs = FileSystem() 325 fs = FileSystem()
323 326
324 self.assertEqual(fs.sep, os.sep) 327 self.assertEqual(fs.sep, os.sep)
325 self.assertEqual(fs.join("foo", "bar"), 328 self.assertEqual(fs.join("foo", "bar"),
326 os.path.join("foo", "bar")) 329 os.path.join("foo", "bar"))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698