From 6e54d5eac45cf94e3aaa508c689e8fbcc1d55f84 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 20 Apr 2023 06:34:17 -0500 Subject: [PATCH 1/2] fix write_executable test --- .github/workflows/test.yml | 1 + jupyter_core/tests/test_command.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9ed514..a1a3e00 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,6 +50,7 @@ jobs: coverage: runs-on: ubuntu-latest + if: always() needs: - build steps: diff --git a/jupyter_core/tests/test_command.py b/jupyter_core/tests/test_command.py index dc457d5..da338d3 100644 --- a/jupyter_core/tests/test_command.py +++ b/jupyter_core/tests/test_command.py @@ -62,11 +62,14 @@ def write_executable(path, source): if sys.platform == "win32": try: - import pkg_resources + import importlib.resources - w = pkg_resources.resource_string("setuptools", "cli-32.exe") + wp = importlib.resources.files('setuptools').joinpath('cli-32.exe') + w = wp.read_bytes() except (ImportError, FileNotFoundError, SystemError): - pytest.skip("Need pkg_resources/setuptools to make scripts executable on Windows") + pytest.skip( + "Need importlib.resources and setuptools to make scripts executable on Windows" + ) exe.write(w, "wb") exe.chmod(0o700) From cc1dddbc86d6d5e291217e87170a62f621b124fe Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 20 Apr 2023 06:40:28 -0500 Subject: [PATCH 2/2] fix write_executable test --- jupyter_core/tests/test_command.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jupyter_core/tests/test_command.py b/jupyter_core/tests/test_command.py index da338d3..73d938c 100644 --- a/jupyter_core/tests/test_command.py +++ b/jupyter_core/tests/test_command.py @@ -64,6 +64,8 @@ def write_executable(path, source): try: import importlib.resources + if not hasattr(importlib.resources, 'files'): + raise ImportError wp = importlib.resources.files('setuptools').joinpath('cli-32.exe') w = wp.read_bytes() except (ImportError, FileNotFoundError, SystemError):