Commit 93912b9e authored by Jason R. Coombs's avatar Jason R. Coombs

Issue #19286: Adding test demonstrating the failure when a directory is found...

Issue #19286: Adding test demonstrating the failure when a directory is found in the package_data globs.
parent 35aca896
......@@ -121,6 +121,37 @@ class BuildPyTestCase(support.TempdirManager,
found = os.listdir(os.path.join(cmd.build_lib, '__pycache__'))
self.assertEqual(sorted(found), ['boiledeggs.%s.pyo' % imp.get_tag()])
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
dist = self.create_dist()[1]
......
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