skip any directories on stat expedition

This commit is contained in:
Martin A. Brown 2016-04-01 22:17:53 -07:00
parent f5af96d1bf
commit 673ddaf3e9
2 changed files with 4 additions and 1 deletions

View File

@ -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__))

View 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: