Skip to content

Commit

Permalink
Add test capturing expectation. Ref #1451.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 21, 2020
1 parent cfbefe5 commit 52e7188
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions setuptools/tests/test_build_py.py
@@ -1,4 +1,6 @@
import os
import stat
import shutil

from setuptools.dist import Distribution

Expand All @@ -20,3 +22,28 @@ def test_directories_in_package_data_glob(tmpdir_cwd):
os.makedirs('path/subpath')
dist.parse_command_line()
dist.run_commands()


def test_read_only(tmpdir_cwd):
"""
Ensure mode is not preserved in copy for package modules
and package data, as that causes problems
with deleting read-only files on Windows.
#1451
"""
dist = Distribution(dict(
script_name='setup.py',
script_args=['build_py'],
packages=['pkg'],
package_data={'pkg': ['data.dat']},
name='pkg',
))
os.makedirs('pkg')
open('pkg/__init__.py', 'w').close()
open('pkg/data.dat', 'w').close()
os.chmod('pkg/__init__.py', stat.S_IREAD)
os.chmod('pkg/data.dat', stat.S_IREAD)
dist.parse_command_line()
dist.run_commands()
shutil.rmtree('build')

0 comments on commit 52e7188

Please sign in to comment.