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

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

Issue 500453002: Extend functionality of MockFileSystem.move() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « Tools/Scripts/webkitpy/common/system/filesystem_mock.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 self.fs.rmtree('foodir') 117 self.fs.rmtree('foodir')
118 self.assertFalse(self.fs.exists('foodir')) 118 self.assertFalse(self.fs.exists('foodir'))
119 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz'))) 119 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz')))
120 120
121 def test_copytree(self): 121 def test_copytree(self):
122 self.fs.chdir(self.generic_test_dir) 122 self.fs.chdir(self.generic_test_dir)
123 self.fs.copytree('foodir/', 'bardir/') 123 self.fs.copytree('foodir/', 'bardir/')
124 self.assertTrue(self.fs.exists('bardir')) 124 self.assertTrue(self.fs.exists('bardir'))
125 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz'))) 125 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz')))
126 126
127 def test_move(self):
128 self.fs.chdir(self.generic_test_dir)
129 self.fs.move('foo.txt', 'bar.txt')
130 self.assertFalse(self.fs.exists('foo.txt'))
131 self.assertTrue(self.fs.exists('bar.txt'))
132 self.fs.move('foodir', 'bardir')
133 self.assertFalse(self.fs.exists('foodir'))
134 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz')))
135 self.assertTrue(self.fs.exists('bardir'))
136 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz')))
137
127 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): 138 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests):
128 def setUp(self): 139 def setUp(self):
129 self.fs = FileSystem() 140 self.fs = FileSystem()
130 self.setup_generic_test_dir() 141 self.setup_generic_test_dir()
131 142
132 self._this_dir = os.path.dirname(os.path.abspath(__file__)) 143 self._this_dir = os.path.dirname(os.path.abspath(__file__))
133 self._missing_file = os.path.join(self._this_dir, 'missing_file.py') 144 self._missing_file = os.path.join(self._this_dir, 'missing_file.py')
134 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py') 145 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py')
135 146
136 def tearDown(self): 147 def tearDown(self):
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 fs = FileSystem() 317 fs = FileSystem()
307 self.assertTrue(fs.remove('filename', remove_with_exception)) 318 self.assertTrue(fs.remove('filename', remove_with_exception))
308 self.assertEqual(-1, RealFileSystemTest._remove_failures) 319 self.assertEqual(-1, RealFileSystemTest._remove_failures)
309 320
310 def test_sep(self): 321 def test_sep(self):
311 fs = FileSystem() 322 fs = FileSystem()
312 323
313 self.assertEqual(fs.sep, os.sep) 324 self.assertEqual(fs.sep, os.sep)
314 self.assertEqual(fs.join("foo", "bar"), 325 self.assertEqual(fs.join("foo", "bar"),
315 os.path.join("foo", "bar")) 326 os.path.join("foo", "bar"))
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/common/system/filesystem_mock.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698