Skip to content

Commit

Permalink
Make sure user gets warned when using distutils
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 4, 2021
1 parent 08235e8 commit 9d0dc41
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion setuptools/tests/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def test_package_data_and_include_package_data_in_sdist(self):

self.assert_package_data_in_manifest(cmd)

def test_custom_build_py(self):
@mock.patch('setuptools.command.egg_info.log')
def test_custom_build_py(self, log_stub):
"""
Ensure projects defining custom build_py don't break
when creating sdists (issue #2849)
Expand Down Expand Up @@ -185,6 +186,19 @@ def get_data_files(self):
using_custom_command_guard.assert_called()
self.assert_package_data_in_manifest(cmd)

warn_stub = log_stub.warn
warn_stub.assert_called()
for call in warn_stub.call_args_list:
args, _kw = call
if "setuptools instead of distutils" in args[0]:
return
else:
raise AssertionError(
"The user should have been warned to extend setuptools command"
" classes instead of distutils",
warn_stub.call_args_list
)

def test_setup_py_exists(self):
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'foo.py'
Expand Down

0 comments on commit 9d0dc41

Please sign in to comment.