diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2015-09-06 22:42:32 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-09-06 22:42:32 -0400 |
| commit | 34d2c5a13852c7e668df91b1fde4ad8465897f29 (patch) | |
| tree | 56a8b34c1d26b66cd22d0edfb9de0fdece1ecc72 /setuptools | |
| parent | c8364b9cf2eeccf684777e53ae4abad2e4fc30b3 (diff) | |
| parent | 3c0d3a91f64a9174f6e3473bbcea3be42045004a (diff) | |
| download | python-setuptools-git-34d2c5a13852c7e668df91b1fde4ad8465897f29.tar.gz | |
Merge
Diffstat (limited to 'setuptools')
| -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 |
