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

Side by Side Diff: tools/telemetry/third_party/pyfakefs/pyfakefs/example_test.py

Issue 1313163007: [Telemetry] Update pyfakefs to latest revision. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to 7e8e097c0165ba9d51fa9d34a0888d8ec082d15b Created 5 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
OLDNEW
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 # 2 #
3 # Copyright 2014 Altera Corporation. All Rights Reserved. 3 # Copyright 2014 Altera Corporation. All Rights Reserved.
4 # Author: John McGehee 4 # Author: John McGehee
5 # 5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License. 7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at 8 # You may obtain a copy of the License at
9 # 9 #
10 # http://www.apache.org/licenses/LICENSE-2.0 10 # http://www.apache.org/licenses/LICENSE-2.0
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 prefer the familiar `os.makedirs()`, which also works fine on the fake 105 prefer the familiar `os.makedirs()`, which also works fine on the fake
106 file system. 106 file system.
107 ''' 107 '''
108 self.assertFalse(os.path.isdir('/test')) 108 self.assertFalse(os.path.isdir('/test'))
109 self.fs.CreateDirectory('/test/dir1/dir2a') 109 self.fs.CreateDirectory('/test/dir1/dir2a')
110 self.assertTrue(os.path.isdir('/test/dir1/dir2a')) 110 self.assertTrue(os.path.isdir('/test/dir1/dir2a'))
111 # os.mkdirs() works, too. 111 # os.mkdirs() works, too.
112 os.makedirs('/test/dir1/dir2b') 112 os.makedirs('/test/dir1/dir2b')
113 self.assertTrue(os.path.isdir('/test/dir1/dir2b')) 113 self.assertTrue(os.path.isdir('/test/dir1/dir2b'))
114 114
115 self.assertItemsEqual(example.get_glob('/test/dir1/nonexistent*'), 115 self.assertCountEqual(example.get_glob('/test/dir1/nonexistent*'),
116 []) 116 [])
117 self.assertItemsEqual(example.get_glob('/test/dir1/dir*'), 117 self.assertCountEqual(example.get_glob('/test/dir1/dir*'),
118 ['/test/dir1/dir2a', '/test/dir1/dir2b']) 118 ['/test/dir1/dir2a', '/test/dir1/dir2b'])
119 119
120 def test_rm_tree(self): 120 def test_rm_tree(self):
121 '''Test example.rm_tree() 121 '''Test example.rm_tree()
122 122
123 `self.fs.CreateDirectory()` creates directories. However, you might 123 `self.fs.CreateDirectory()` creates directories. However, you might
124 prefer the familiar `os.makedirs()`, which also works fine on the fake 124 prefer the familiar `os.makedirs()`, which also works fine on the fake
125 file system. 125 file system.
126 ''' 126 '''
127 self.fs.CreateDirectory('/test/dir1/dir2a') 127 self.fs.CreateDirectory('/test/dir1/dir2a')
128 # os.mkdirs() works, too. 128 # os.mkdirs() works, too.
129 os.makedirs('/test/dir1/dir2b') 129 os.makedirs('/test/dir1/dir2b')
130 self.assertTrue(os.path.isdir('/test/dir1/dir2b')) 130 self.assertTrue(os.path.isdir('/test/dir1/dir2b'))
131 self.assertTrue(os.path.isdir('/test/dir1/dir2a')) 131 self.assertTrue(os.path.isdir('/test/dir1/dir2a'))
132 132
133 example.rm_tree('/test/dir1') 133 example.rm_tree('/test/dir1')
134 self.assertFalse(os.path.exists('/test/dir1')) 134 self.assertFalse(os.path.exists('/test/dir1'))
135 135
136 if __name__ == "__main__": 136 if __name__ == "__main__":
137 unittest.main() 137 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698