Commit 118e2450 authored by Jason R. Coombs's avatar Jason R. Coombs

Add test capturing failure when find_packages no longer follows symlinks. Ref #195

--HG--
extra : amend_source : 4efa6b87d3acaefebdfcc953e78a452ffc1f160d
parent 0515f307
[ssl:sys_platform=='win32']
wincertstore==0.2
[certs]
certifi==1.0.1
\ No newline at end of file
certifi==1.0.1
[ssl:sys_platform=='win32']
wincertstore==0.2
\ No newline at end of file
"""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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment