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

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: Created 6 years, 4 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 def test_rmtree(self): 112 def test_rmtree(self):
113 self.fs.chdir(self.generic_test_dir) 113 self.fs.chdir(self.generic_test_dir)
114 self.fs.rmtree('foo') 114 self.fs.rmtree('foo')
115 self.assertTrue(self.fs.exists('foodir')) 115 self.assertTrue(self.fs.exists('foodir'))
116 self.assertTrue(self.fs.exists(self.fs.join('foodir', 'baz'))) 116 self.assertTrue(self.fs.exists(self.fs.join('foodir', 'baz')))
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_move(self):
122 self.fs.chdir(self.generic_test_dir)
123 self.fs.move('foo.txt', 'bar.txt')
124 self.assertFalse(self.fs.exists('foo.txt'))
125 self.assertTrue(self.fs.exists('bar.txt'))
126 self.fs.move('foodir', 'bardir')
127 self.assertFalse(self.fs.exists('foodir'))
128 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz')))
129 self.assertTrue(self.fs.exists('bardir'))
130 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz')))
131
121 132
122 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): 133 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests):
123 def setUp(self): 134 def setUp(self):
124 self.fs = FileSystem() 135 self.fs = FileSystem()
125 self.setup_generic_test_dir() 136 self.setup_generic_test_dir()
126 137
127 self._this_dir = os.path.dirname(os.path.abspath(__file__)) 138 self._this_dir = os.path.dirname(os.path.abspath(__file__))
128 self._missing_file = os.path.join(self._this_dir, 'missing_file.py') 139 self._missing_file = os.path.join(self._this_dir, 'missing_file.py')
129 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py') 140 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py')
130 141
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 fs = FileSystem() 312 fs = FileSystem()
302 self.assertTrue(fs.remove('filename', remove_with_exception)) 313 self.assertTrue(fs.remove('filename', remove_with_exception))
303 self.assertEqual(-1, RealFileSystemTest._remove_failures) 314 self.assertEqual(-1, RealFileSystemTest._remove_failures)
304 315
305 def test_sep(self): 316 def test_sep(self):
306 fs = FileSystem() 317 fs = FileSystem()
307 318
308 self.assertEqual(fs.sep, os.sep) 319 self.assertEqual(fs.sep, os.sep)
309 self.assertEqual(fs.join("foo", "bar"), 320 self.assertEqual(fs.join("foo", "bar"),
310 os.path.join("foo", "bar")) 321 os.path.join("foo", "bar"))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698