From 6888abcc8536cb3b2d84d2e8aaba4a4c946ca516 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 2 Feb 2024 15:53:05 -0600 Subject: [PATCH] Better handling of older setuptools versions --- test/spell_check.words | 2 ++ test/test_build_python.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/spell_check.words b/test/spell_check.words index a1cb3d99..7e4c8e81 100644 --- a/test/spell_check.words +++ b/test/spell_check.words @@ -47,6 +47,7 @@ hookimpl hookwrapper https importlib +importorskip isatty iterdir junit @@ -56,6 +57,7 @@ lineno linter linux lstrip +minversion mkdtemp monkeypatch namedtuple diff --git a/test/test_build_python.py b/test/test_build_python.py index cab97a75..7780a567 100644 --- a/test/test_build_python.py +++ b/test/test_build_python.py @@ -51,6 +51,9 @@ def _test_build_package( assert not libexec_pattern or setup_cfg, \ 'The libexec pattern requires use of setup.cfg' + if setup_cfg and data_files: + pytest.importorskip('setuptools', minversion='40.5.0') + event_loop = new_event_loop() asyncio.set_event_loop(event_loop) try: @@ -64,7 +67,7 @@ def _test_build_package( **( { 'data_files': [ - ('share/test-package', ['test-resource']), + ('share/test_package', ['test-resource']), ] } if data_files else {} ) @@ -106,7 +109,7 @@ def _test_build_package( if libexec_pattern else '' ) + ( '[options.data_files]\n' - 'share/test-package = test-resource\n' + 'share/test_package = test-resource\n' if data_files else '' ) ) @@ -121,7 +124,7 @@ def _test_build_package( ' },\n' + ( ' data_files=[\n' - ' ("share/test-package", [\n' + ' ("share/test_package", [\n' ' "test-resource",\n' ' ]),\n' ' ],\n' @@ -158,7 +161,7 @@ def _test_build_package( any(install_base.rglob('bin/my_command*')) or any(install_base.rglob('Scripts/my_command*'))) assert data_files == any(install_base.rglob( - 'share/test-package/test-resource')) + 'share/test_package/test-resource')) if not symlink_install: pkg_info, = install_base.rglob('PKG-INFO')