[Python-checkins] cpython (2.7): Issue #19286: Adding test demonstrating the failure when a directory is found
jason.coombs
python-checkins at python.org
Sat Nov 2 16:58:18 CET 2013
http://hg.python.org/cpython/rev/22bac968e226
changeset: 86846:22bac968e226
branch: 2.7
parent: 86838:0554e2d37bf8
user: Jason R. Coombs <jaraco at jaraco.com>
date: Sat Nov 02 11:29:33 2013 -0400
summary:
Issue #19286: Adding test demonstrating the failure when a directory is found in the package_data globs.
files:
Lib/distutils/tests/test_build_py.py | 31 ++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/Lib/distutils/tests/test_build_py.py b/Lib/distutils/tests/test_build_py.py
--- a/Lib/distutils/tests/test_build_py.py
+++ b/Lib/distutils/tests/test_build_py.py
@@ -99,6 +99,37 @@
os.chdir(cwd)
sys.stdout = old_stdout
+ def test_dir_in_package_data(self):
+ """
+ A directory in package_data should not be added to the filelist.
+ """
+ # See bug 19286
+ sources = self.mkdtemp()
+ pkg_dir = os.path.join(sources, "pkg")
+
+ os.mkdir(pkg_dir)
+ open(os.path.join(pkg_dir, "__init__.py"), "w").close()
+
+ docdir = os.path.join(pkg_dir, "doc")
+ os.mkdir(docdir)
+ open(os.path.join(docdir, "testfile"), "w").close()
+
+ # create the directory that could be incorrectly detected as a file
+ os.mkdir(os.path.join(docdir, 'otherdir'))
+
+ os.chdir(sources)
+ dist = Distribution({"packages": ["pkg"],
+ "package_data": {"pkg": ["doc/*"]}})
+ # script_name need not exist, it just need to be initialized
+ dist.script_name = os.path.join(sources, "setup.py")
+ dist.script_args = ["build"]
+ dist.parse_command_line()
+
+ try:
+ dist.run_commands()
+ except DistutilsFileError:
+ self.fail("failed package_data when data dir includes a dir")
+
def test_dont_write_bytecode(self):
# makes sure byte_compile is not used
pkg_dir, dist = self.create_dist()
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list