]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add test that was promised in a comment but not actually written
authorÉric Araujo <merwok@netwok.org>
Thu, 6 Oct 2011 03:15:09 +0000 (05:15 +0200)
committerÉric Araujo <merwok@netwok.org>
Thu, 6 Oct 2011 03:15:09 +0000 (05:15 +0200)
Lib/packaging/tests/test_uninstall.py

index 614b1877fad290b9b92b24007967e4c165f79fb0..7603a40cd7461641739ad714bfdaa4b6178adad4 100644 (file)
@@ -1,6 +1,7 @@
 """Tests for the uninstall command."""
 import os
 import sys
+import logging
 from io import StringIO
 import stat
 import packaging.util
@@ -105,14 +106,14 @@ class UninstallTestCase(support.TempdirManager,
 
     def test_remove_issue(self):
         # makes sure if there are OSErrors (like permission denied)
-        # remove() stops and display a clean error
+        # remove() stops and displays a clean error
         dist, site_packages = self.install_dist('Meh')
 
         # breaking os.rename
         old = os.rename
 
         def _rename(source, target):
-            raise OSError
+            raise OSError(42, 'impossible operation')
 
         os.rename = _rename
         try:
@@ -120,6 +121,10 @@ class UninstallTestCase(support.TempdirManager,
         finally:
             os.rename = old
 
+        logs = [log for log in self.get_logs(logging.INFO)
+                if log.startswith('Error:')]
+        self.assertEqual(logs, ['Error: [Errno 42] impossible operation'])
+
         self.assertTrue(remove('Meh', paths=[site_packages]))