From 0c5c2d4dd2412721c6715f1527c4273b8cc941da Mon Sep 17 00:00:00 2001 From: "g@localhost.localdomain" Date: Sat, 25 Nov 2006 15:06:15 +0100 Subject: [PATCH] More context in the error message --- pysize/core/compute_size.py | 2 +- tests/tests/compute_size.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pysize/core/compute_size.py b/pysize/core/compute_size.py index 56bb58a..c4b7f76 100644 --- a/pysize/core/compute_size.py +++ b/pysize/core/compute_size.py @@ -62,7 +62,7 @@ def _fast(path, dir_ino, cross_device, error_cb): size = st.st_blocks * 512 return size except OSError, e: - error_cb('size.fast(%s)' % (path), e) + error_cb('(%s) size.fast(%s)' % (os.getcwd(), path), e) return 0 def slow(path, cross_device=True, error_cb=log_error): diff --git a/tests/tests/compute_size.py b/tests/tests/compute_size.py index c410547..d08b5ad 100644 --- a/tests/tests/compute_size.py +++ b/tests/tests/compute_size.py @@ -52,8 +52,9 @@ class TestComputeSize(unittest.TestCase): size = compute_size.slow('/tmp/pysize_example_dir', error_cb=logger.log_error) self.assertEqual(size, 4608000) - self.assertEqual(logger.log, "size.fast(unreadable_dir) " + - "[Errno 13] Permission denied: 'unreadable_dir'") + self.assertEqual(logger.log, "(/tmp/pysize_example_dir) " + + "size.fast(unreadable_dir) [Errno 13] " + + "Permission denied: 'unreadable_dir'") # Retry using cached results size = compute_size.slow('/tmp/pysize_example_dir', error_cb=fatal) -- 2.11.4.GIT