aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_build_py.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-03-21 06:28:17 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-03-21 12:49:44 -0400
commit52e718872259617203556e4889d451167f209343 (patch)
tree37bc0e80dd024f4e7b0d9d780bc9ad76b3afd26c /setuptools/tests/test_build_py.py
parentcfbefe5715e31db3c8cac70f7a1cd1c16fd4b5a7 (diff)
downloadexternal_python_setuptools-52e718872259617203556e4889d451167f209343.tar.gz
external_python_setuptools-52e718872259617203556e4889d451167f209343.tar.bz2
external_python_setuptools-52e718872259617203556e4889d451167f209343.zip
Add test capturing expectation. Ref #1451.
Diffstat (limited to 'setuptools/tests/test_build_py.py')
-rw-r--r--setuptools/tests/test_build_py.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/setuptools/tests/test_build_py.py b/setuptools/tests/test_build_py.py
index b3a99f56..92b455dd 100644
--- a/setuptools/tests/test_build_py.py
+++ b/setuptools/tests/test_build_py.py
@@ -1,4 +1,6 @@
import os
+import stat
+import shutil
from setuptools.dist import Distribution
@@ -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')