mirror of https://github.com/tLDP/python-tldp
no point in using makefh() now; remove
This commit is contained in:
parent
10854ad6df
commit
f20fb1c481
|
@ -251,18 +251,5 @@ class Test_att_statinfo(unittest.TestCase):
|
||||||
def test_max_mtime(self):
|
def test_max_mtime(self):
|
||||||
pass
|
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
|
# -- end of file
|
||||||
|
|
|
@ -231,18 +231,6 @@ http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python/37
|
||||||
return None
|
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):
|
def statfile(name):
|
||||||
'''return posix.stat_result (or None) for a single file name'''
|
'''return posix.stat_result (or None) for a single file name'''
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue