mirror of https://github.com/tLDP/python-tldp
skip any directories on stat expedition
This commit is contained in:
parent
f5af96d1bf
commit
673ddaf3e9
|
@ -147,7 +147,8 @@ class Test_statfiles(unittest.TestCase):
|
|||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
statinfo = statfiles(here, relative=here)
|
||||
self.assertIsInstance(statinfo, dict)
|
||||
self.assertTrue(os.path.basename('sample-documents') in statinfo)
|
||||
adoc = 'sample-documents/asciidoc-complete.txt'
|
||||
self.assertTrue(adoc in statinfo)
|
||||
|
||||
def test_statfiles_dir_rel(self):
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
|
|
|
@ -310,6 +310,8 @@ def statfiles(name, relative=None):
|
|||
inodes.extend(files)
|
||||
for x in inodes:
|
||||
foundpath = os.path.join(root, x)
|
||||
if os.path.isdir(foundpath):
|
||||
continue
|
||||
if relative:
|
||||
relpath = os.path.relpath(foundpath, start=relative)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue