diff options
author | Éric Araujo <merwok@netwok.org> | 2011-10-06 03:15:09 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-10-06 03:15:09 (GMT) |
commit | fa23cc842c22b945f1fd1126810991daddbd7314 (patch) | |
tree | 1f5e0b0ab3a04b9548e1d65d9103b906cf25f4c7 /Lib/packaging | |
parent | 9556a5bab277eff83b40236c58c3fb7d0233dc47 (diff) | |
download | cpython-fa23cc842c22b945f1fd1126810991daddbd7314.zip cpython-fa23cc842c22b945f1fd1126810991daddbd7314.tar.gz cpython-fa23cc842c22b945f1fd1126810991daddbd7314.tar.bz2 |
Add test that was promised in a comment but not actually written
Diffstat (limited to 'Lib/packaging')
-rw-r--r-- | Lib/packaging/tests/test_uninstall.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/packaging/tests/test_uninstall.py b/Lib/packaging/tests/test_uninstall.py index 614b187..7603a40 100644 --- a/Lib/packaging/tests/test_uninstall.py +++ b/Lib/packaging/tests/test_uninstall.py @@ -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])) |