summaryrefslogtreecommitdiffstats
path: root/gluster
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2013-05-23 20:52:19 -0400
committerLuis Pabon <lpabon@redhat.com>2013-05-24 12:17:19 -0700
commite2b9e5e06cc824b006ca984081c4956eaf887393 (patch)
tree6cd07a81cc369bb37abf81649c7b831e4bc364f3 /gluster
parent833d7fc7dfe077b39eade72a5496a40181b20a0c (diff)
Bring DiskFile module coverge to 100%
To bring the DiskFile module coverage to 100%, we first recognize that do_fsync() will invoke fsync() in a separate thread, which gives coverage fits (see the commit history at https://github.com/portante/coverage/commits/master). To avoid that, we mock out do_fsync to make it a no-op and avoid the problem. The second thing we recognize is that mkstemp() relies on do_unlink from the fs_utils module, which already consumes ENOENT errors, so we don't need that code path in mkstemp() itself. The unused mock routine for do_unlink was removed as well, and we renamed the other do_unlink mock routine to os_unlink since it was mocking out os.unlink directly. Lastly, we rejigger the error on close test for mkstemp() to prematurely close the fd to cause an error which should just be squelched, completing the full coverage. Change-Id: I98283c17cf139f92282f8afd7083d567d3dd9a79 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/5082 Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'gluster')
-rw-r--r--gluster/swift/common/DiskFile.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/gluster/swift/common/DiskFile.py b/gluster/swift/common/DiskFile.py
index 577147a..c74921b 100644
--- a/gluster/swift/common/DiskFile.py
+++ b/gluster/swift/common/DiskFile.py
@@ -332,8 +332,4 @@ class Gluster_DiskFile(DiskFile):
except OSError:
pass
tmppath, self.tmppath = self.tmppath, None
- try:
- do_unlink(tmppath)
- except OSError as err:
- if err.errno != errno.ENOENT:
- raise
+ do_unlink(tmppath)