diff options
author | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-08-18 23:20:42 +0900 |
---|---|---|
committer | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-08-18 23:20:42 +0900 |
commit | 60911efe0572bd6ce0529e1cea159bd28d7e58d8 (patch) | |
tree | c440c99d70e4b2e1ffffa88706161a0a787dd949 /tests/util.py | |
parent | 53fad8948200030c3caa8dd611174d9b6c035eff (diff) | |
parent | eaed3ca9f1a1ed1ff2c1ee1ab67bb1949919babe (diff) | |
download | sphinx-git-60911efe0572bd6ce0529e1cea159bd28d7e58d8.tar.gz |
Merge with tip
Diffstat (limited to 'tests/util.py')
-rw-r--r-- | tests/util.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/util.py b/tests/util.py index 1b5719b5f..bbfb2d4b9 100644 --- a/tests/util.py +++ b/tests/util.py @@ -7,6 +7,7 @@ :license: BSD, see LICENSE for details. """ +import os import sys import tempfile import shutil @@ -244,3 +245,11 @@ def sprint(*args): _unicode_literals_re = re.compile(r'u(".*?")|u(\'.*?\')') def remove_unicode_literals(s): return _unicode_literals_re.sub(lambda x: x.group(1) or x.group(2), s) + + +def find_files(root, suffix=None): + for dirpath, dirs, files in os.walk(root, followlinks=True): + dirpath = path(dirpath) + for f in [f for f in files if not suffix or f.endswith(suffix)]: + fpath = dirpath / f + yield os.path.relpath(fpath, root) |