Skip to content

Commit

Permalink
Fix write_executable test (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Apr 20, 2023
1 parent 3536352 commit 5e124d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit 5e124d2

Please sign in to comment.