Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(14)

Side by Side Diff: Lib/packaging/tests/test_uninstall.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/packaging/tests/test_command_upload_docs.py ('k') | Lib/packaging/tests/test_util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Tests for the uninstall command.""" 1 """Tests for the uninstall command."""
2 import os 2 import os
3 import sys 3 import sys
4 from io import StringIO 4 from io import StringIO
5 import stat 5 import stat
6 import packaging.util 6 import packaging.util
7 7
8 from packaging.database import disable_cache, enable_cache 8 from packaging.database import disable_cache, enable_cache
9 from packaging.run import main 9 from packaging.run import main
10 from packaging.errors import PackagingError 10 from packaging.errors import PackagingError
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 old_out = sys.stderr 86 old_out = sys.stderr
87 sys.stderr = StringIO() 87 sys.stderr = StringIO()
88 dist = self.run_setup('install_dist', '--prefix=' + self.root_dir) 88 dist = self.run_setup('install_dist', '--prefix=' + self.root_dir)
89 install_lib = self.get_path(dist, 'purelib') 89 install_lib = self.get_path(dist, 'purelib')
90 return dist, install_lib 90 return dist, install_lib
91 91
92 def test_uninstall_unknow_distribution(self): 92 def test_uninstall_unknow_distribution(self):
93 self.assertRaises(PackagingError, remove, 'Foo', 93 self.assertRaises(PackagingError, remove, 'Foo',
94 paths=[self.root_dir]) 94 paths=[self.root_dir])
95 95
96 @unittest.skipIf(sys.platform == 'win32', 'deactivated for now')
96 def test_uninstall(self): 97 def test_uninstall(self):
97 dist, install_lib = self.install_dist() 98 dist, install_lib = self.install_dist()
98 self.assertIsFile(install_lib, 'foo', '__init__.py') 99 self.assertIsFile(install_lib, 'foo', '__init__.py')
99 self.assertIsFile(install_lib, 'foo', 'sub', '__init__.py') 100 self.assertIsFile(install_lib, 'foo', 'sub', '__init__.py')
100 self.assertIsFile(install_lib, 'Foo-0.1.dist-info', 'RECORD') 101 self.assertIsFile(install_lib, 'Foo-0.1.dist-info', 'RECORD')
101 self.assertTrue(remove('Foo', paths=[install_lib])) 102 self.assertTrue(remove('Foo', paths=[install_lib]))
102 self.assertIsNotFile(install_lib, 'foo', 'sub', '__init__.py') 103 self.assertIsNotFile(install_lib, 'foo', 'sub', '__init__.py')
103 self.assertIsNotFile(install_lib, 'Foo-0.1.dist-info', 'RECORD') 104 self.assertIsNotFile(install_lib, 'Foo-0.1.dist-info', 'RECORD')
104 105
106 @unittest.skipIf(sys.platform == 'win32', 'deactivated for now')
105 def test_remove_issue(self): 107 def test_remove_issue(self):
106 # makes sure if there are OSErrors (like permission denied) 108 # makes sure if there are OSErrors (like permission denied)
107 # remove() stops and display a clean error 109 # remove() stops and display a clean error
108 dist, install_lib = self.install_dist('Meh') 110 dist, install_lib = self.install_dist('Meh')
109 111
110 # breaking os.rename 112 # breaking os.rename
111 old = os.rename 113 old = os.rename
112 114
113 def _rename(source, target): 115 def _rename(source, target):
114 raise OSError 116 raise OSError
115 117
116 os.rename = _rename 118 os.rename = _rename
117 try: 119 try:
118 self.assertFalse(remove('Meh', paths=[install_lib])) 120 self.assertFalse(remove('Meh', paths=[install_lib]))
119 finally: 121 finally:
120 os.rename = old 122 os.rename = old
121 123
122 self.assertTrue(remove('Meh', paths=[install_lib])) 124 self.assertTrue(remove('Meh', paths=[install_lib]))
123 125
124 126
125 def test_suite(): 127 def test_suite():
126 return unittest.makeSuite(UninstallTestCase) 128 return unittest.makeSuite(UninstallTestCase)
127 129
128 if __name__ == '__main__': 130 if __name__ == '__main__':
129 unittest.main(defaultTest='test_suite') 131 unittest.main(defaultTest='test_suite')
OLDNEW
« no previous file with comments | « Lib/packaging/tests/test_command_upload_docs.py ('k') | Lib/packaging/tests/test_util.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+