diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-31 10:51:55 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-31 10:51:55 -0500 |
commit | 29fa01621c3de0a5c78c4f49b5d051386d0d566f (patch) | |
tree | fce7387c8ba82178be987b004cbda1c22005a04f /setuptools/tests/test_setuptools.py | |
parent | 928324bd76f35e9c8c526df828577b5640a95ed0 (diff) | |
parent | 6bdbe8957d8c8d293e3fea3fa4baf45eb7c3a3a4 (diff) | |
download | external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.gz external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.bz2 external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.zip |
Merge with master. Ref #229.
--HG--
branch : feature/issue-229
Diffstat (limited to 'setuptools/tests/test_setuptools.py')
-rw-r--r-- | setuptools/tests/test_setuptools.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py new file mode 100644 index 00000000..e59800d2 --- /dev/null +++ b/setuptools/tests/test_setuptools.py @@ -0,0 +1,48 @@ +import os + +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', os.path.join('foo', 'bar.py')] + assert found == expected + + +@pytest.fixture +def can_symlink(tmpdir): + """ + Skip if cannot create a symbolic link + """ + link_fn = 'link' + target_fn = 'target' + try: + os.symlink(target_fn, link_fn) + except (OSError, NotImplementedError, AttributeError): + pytest.skip("Cannot create symbolic links") + os.remove(link_fn) + + +def test_findall_missing_symlink(tmpdir, can_symlink): + with tmpdir.as_cwd(): + os.symlink('foo', 'bar') + found = list(setuptools.findall()) + assert found == [] |