Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
base
Commits
25fa93a8
Commit
25fa93a8
authored
3 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: test createFSLWrapper with pythonw
parent
c0b8c237
No related branches found
No related tags found
1 merge request
!18
Detect pythonw scripts
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_create_remove_wrapper.py
+35
-0
35 additions, 0 deletions
tests/test_create_remove_wrapper.py
with
35 additions
and
0 deletions
tests/test_create_remove_wrapper.py
+
35
−
0
View file @
25fa93a8
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment