[Python-checkins] cpython: Add test that was promised in a comment but not actually written
eric.araujo
python-checkins at python.org
Thu Oct 6 13:24:14 CEST 2011
http://hg.python.org/cpython/rev/2d5b7993fae1
changeset: 72741:2d5b7993fae1
user: Éric Araujo <merwok at netwok.org>
date: Thu Oct 06 05:15:09 2011 +0200
summary:
Add test that was promised in a comment but not actually written
files:
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
--- 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 @@
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 @@
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]))
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list