summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_find_packages.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-05-03 13:14:22 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-05-03 13:14:22 -0400
commit118e245064fe77ea85ae936223edf09ff1448314 (patch)
tree5c0a46bae89063ee18cc7352c16381aa26f6c3c9 /setuptools/tests/test_find_packages.py
parent0515f30739d1dce3bc10921db403f336358ef447 (diff)
downloadpython-setuptools-git-118e245064fe77ea85ae936223edf09ff1448314.tar.gz
Add test capturing failure when find_packages no longer follows symlinks. Ref #195
--HG-- extra : amend_source : 4efa6b87d3acaefebdfcc953e78a452ffc1f160d
Diffstat (limited to 'setuptools/tests/test_find_packages.py')
-rw-r--r--setuptools/tests/test_find_packages.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/setuptools/tests/test_find_packages.py b/setuptools/tests/test_find_packages.py
index 47ea9e05..92f7aff7 100644
--- a/setuptools/tests/test_find_packages.py
+++ b/setuptools/tests/test_find_packages.py
@@ -1,14 +1,24 @@
"""Tests for setuptools.find_packages()."""
import os
+import sys
import shutil
import tempfile
import unittest
+import platform
import setuptools
from setuptools import find_packages
+from setuptools.tests.py26compat import skipIf
find_420_packages = setuptools.PEP420PackageFinder.find
+def has_symlink():
+ bad_symlink = (
+ # Windows symlink directory detection is broken on Python 3.2
+ platform.system() == 'Windows' and sys.version_info[:2] == (3,2)
+ )
+ return hasattr(os, 'symlink') and not bad_symlink
+
class TestFindPackages(unittest.TestCase):
def setUp(self):
@@ -99,6 +109,21 @@ class TestFindPackages(unittest.TestCase):
packages = find_packages(self.dist_dir)
self.assertTrue('build.pkg' not in packages)
+ @skipIf(not has_symlink(), 'Symlink support required')
+ def test_symlinked_packages_are_included(self):
+ """
+ A symbolically-linked directory should be treated like any other
+ directory when matched as a package.
+
+ Create a link from lpkg -> pkg.
+ """
+ self._touch('__init__.py', self.pkg_dir)
+ linked_pkg = os.path.join(self.dist_dir, 'lpkg')
+ os.symlink('pkg', linked_pkg)
+ assert os.path.isdir(linked_pkg)
+ packages = find_packages(self.dist_dir)
+ self.assertTrue('lpkg' in packages)
+
def _assert_packages(self, actual, expected):
self.assertEqual(set(actual), set(expected))