Skip to content
Snippets Groups Projects
Commit 25fa93a8 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: test createFSLWrapper with pythonw

parent c0b8c237
No related branches found
No related tags found
1 merge request!18Detect pythonw scripts
...@@ -126,6 +126,40 @@ def test_create_python_wrapper(): ...@@ -126,6 +126,40 @@ def test_create_python_wrapper():
assert got == expect assert got == expect
def test_create_pythonw_wrapper():
"""Test creation of a wrapper script for a python script which
uses pythonw as the interpreter (for GUI apps on macOS).
"""
hashbangs = [
'#!/bin/bash /usr/bin/pythonw',
'#!/usr/bin/pythonw',
'#!/usr/bin/env pythonw']
with temp_fsldir() as (fsldir, wrapperdir):
script_path = op.join(fsldir, 'bin', 'test_script')
wrapper_path = op.join(wrapperdir, 'test_script')
touch(script_path)
for hb in hashbangs:
with open(script_path, 'wt') as f:
f.write(hb + '\n')
f.write('print("hello")\n')
expect = tw.dedent(f"""
#!/usr/bin/env bash
{fsldir}/bin/pythonw -I {script_path} "$@"
""").strip()
run(f'{CREATE_WRAPPER} test_script')
assert op.exists(wrapper_path)
with open(wrapper_path, 'rt') as f:
got = f.read().strip()
assert got == expect
def test_create_other_wrapper(): def test_create_other_wrapper():
"""Test creation of a wrapper script for a non-python executable.""" """Test creation of a wrapper script for a non-python executable."""
with temp_fsldir() as (fsldir, wrapperdir): with temp_fsldir() as (fsldir, wrapperdir):
...@@ -151,6 +185,7 @@ def test_create_other_wrapper(): ...@@ -151,6 +185,7 @@ def test_create_other_wrapper():
assert got == expect assert got == expect
def test_permissions_preserved(): def test_permissions_preserved():
"""Test that wrapper script has same permissions as wrapped script.""" """Test that wrapper script has same permissions as wrapped script."""
with temp_fsldir() as (fsldir, wrapperdir): with temp_fsldir() as (fsldir, wrapperdir):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment