From f20fb1c48105c8f2b30297b8bb6f94c3adf73359 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Mon, 14 Mar 2016 20:51:55 -0700 Subject: [PATCH] no point in using makefh() now; remove --- tests/test_utils.py | 13 ------------- tldp/utils.py | 12 ------------ 2 files changed, 25 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index ccc5c64..6ab417b 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -251,18 +251,5 @@ class Test_att_statinfo(unittest.TestCase): def test_max_mtime(self): pass - -class Test_makefh(unittest.TestCase): - - def test_makefh(self): - f = ntf(prefix='tldp-makefh-openfile-test-', delete=False) - # fprime = makefh(f.file) - # self.assertIs(f, fprime) - # del fprime - f.close() - fprime = makefh(f.name) - self.assertIs(f.name, fprime.name) - os.unlink(f.name) - # # -- end of file diff --git a/tldp/utils.py b/tldp/utils.py index 4e8a295..2c943a5 100644 --- a/tldp/utils.py +++ b/tldp/utils.py @@ -231,18 +231,6 @@ http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python/37 return None -def makefh(thing): - '''return a file object; given an existing filename name or file object''' - if isinstance(thing, io.IOBase): - f = thing - elif isinstance(thing, str) and os.path.isfile(thing): - f = open(thing) - else: - raise TypeError("Cannot make file from %s of %r" % - (type(thing), thing,)) - return f - - def statfile(name): '''return posix.stat_result (or None) for a single file name''' try: