Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix write_executable test #351

Merged
merged 2 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:

coverage:
runs-on: ubuntu-latest
if: always()
needs:
- build
steps:
Expand Down
11 changes: 8 additions & 3 deletions jupyter_core/tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ 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")
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):
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)

Expand Down