diff options
| -rw-r--r-- | setuptools/__init__.py | 5 | ||||
| -rw-r--r-- | setuptools/tests/test_setuptools.py | 25 |
2 files changed, 28 insertions, 2 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 0d1994dc..e9390336 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -140,8 +140,9 @@ class Command(_Command): distutils.core.Command = Command def findall(dir=os.curdir): - """Find all files under 'dir' and return the list of full filenames - (relative to 'dir'). + """ + Find all files under 'dir' and return the list of full filenames. + Unless dir is '.', return full filenames with dir prepended. """ def _prepend(base): return functools.partial(os.path.join, os.path.relpath(base, dir)) diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py new file mode 100644 index 00000000..e1a06c96 --- /dev/null +++ b/setuptools/tests/test_setuptools.py @@ -0,0 +1,25 @@ +import pytest + +import setuptools + + +@pytest.fixture +def example_source(tmpdir): + tmpdir.mkdir('foo') + (tmpdir / 'foo/bar.py').write('') + (tmpdir / 'readme.txt').write('') + return tmpdir + + +def test_findall(example_source): + found = list(setuptools.findall(str(example_source))) + expected = ['readme.txt', 'foo/bar.py'] + expected = [example_source.join(fn) for fn in expected] + assert found == expected + + +def test_findall_curdir(example_source): + with example_source.as_cwd(): + found = list(setuptools.findall()) + expected = ['readme.txt', 'foo/bar.py'] + assert found == expected |
