Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
zip_utils_test.ZipUtilsTest Class Reference
Inheritance diagram for zip_utils_test.ZipUtilsTest:

Public Member Functions

 test_zip_unzip (self)
 
 test_to_skip (self)
 
 test_nonexistent_dir (self)
 

Detailed Description

Definition at line 21 of file zip_utils_test.py.

Member Function Documentation

◆ test_nonexistent_dir()

zip_utils_test.ZipUtilsTest.test_nonexistent_dir (   self)

Definition at line 67 of file zip_utils_test.py.

67 def test_nonexistent_dir(self):
68 with utils.tmp_dir():
69 with self.assertRaises(IOError):
70 zip_utils.zip('input', 'test.zip')
71
72
zip(target_dir, zip_file, to_skip=None)
Definition zip_utils.py:28

◆ test_to_skip()

zip_utils_test.ZipUtilsTest.test_to_skip (   self)

Definition at line 42 of file zip_utils_test.py.

42 def test_to_skip(self):
43 with utils.tmp_dir():
44 # Create input files and directories.
45 fw = test_utils.FileWriter(os.path.join(os.getcwd(), 'input'))
46 fw.mkdir('.git')
47 fw.write(os.path.join('.git', 'index'))
48 fw.write('somefile')
49 fw.write('.DS_STORE')
50 fw.write('leftover.pyc')
51 fw.write('.pycfile')
52
53 # Zip, unzip.
54 zip_utils.zip('input', 'test.zip', to_skip=['.git', '.DS*', '*.pyc'])
55 zip_utils.unzip('test.zip', 'output')
56
57 # Remove the files/dirs we don't expect to see in output, so that we can
58 # use self._compare_trees to check the results.
59 fw.remove(os.path.join('.git', 'index'))
60 fw.remove('.git')
61 fw.remove('.DS_STORE')
62 fw.remove('leftover.pyc')
63
64 # Compare results.
65 test_utils.compare_trees(self, 'input', 'output')
66
compare_trees(test, a, b)
Definition test_utils.py:46
unzip(zip_file, target_dir)
Definition zip_utils.py:61

◆ test_zip_unzip()

zip_utils_test.ZipUtilsTest.test_zip_unzip (   self)

Definition at line 22 of file zip_utils_test.py.

22 def test_zip_unzip(self):
23 with utils.tmp_dir():
24 fw = test_utils.FileWriter(os.path.join(os.getcwd(), 'input'))
25 # Create input files and directories.
26 fw.mkdir('mydir')
27 fw.mkdir('anotherdir', 0o666)
28 fw.mkdir('dir3', 0o600)
29 fw.mkdir('subdir')
30 fw.write('a.txt', 0o777)
31 fw.write('b.txt', 0o751)
32 fw.write('c.txt', 0o640)
33 fw.write(os.path.join('subdir', 'd.txt'), 0o640)
34
35 # Zip, unzip.
36 zip_utils.zip('input', 'test.zip')
37 zip_utils.unzip('test.zip', 'output')
38
39 # Compare the inputs and outputs.
40 test_utils.compare_trees(self, 'input', 'output')
41

The documentation for this class was generated from the following file: