From 673ddaf3e9efa3097e0b084cf60dde577ccdf94c Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Fri, 1 Apr 2016 22:17:53 -0700 Subject: [PATCH] skip any directories on stat expedition --- tests/test_utils.py | 3 ++- tldp/utils.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 5d720e4..39d7859 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -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__)) diff --git a/tldp/utils.py b/tldp/utils.py index 29c758b..d8766c8 100644 --- a/tldp/utils.py +++ b/tldp/utils.py @@ -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: