Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BioFlow-Insight
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
shareFAIR
BioFlow-Insight
Commits
d9a06fcf
Commit
d9a06fcf
authored
1 year ago
by
Bryan Brancotte
Browse files
Options
Downloads
Patches
Plain Diff
sanitize workflow name to be usable as a filename
parent
8317e93b
No related branches found
No related tags found
1 merge request
!6
Sanitize RO-Crate filename
Pipeline
#13222
passed with stage
in 42 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ro_crate.py
+5
-1
5 additions, 1 deletion
src/ro_crate.py
tests/test_cli.py
+9
-1
9 additions, 1 deletion
tests/test_cli.py
with
14 additions
and
2 deletions
src/ro_crate.py
+
5
−
1
View file @
d9a06fcf
...
@@ -155,5 +155,9 @@ class RO_Crate:
...
@@ -155,5 +155,9 @@ class RO_Crate:
self
.
fill_from_workflow
()
self
.
fill_from_workflow
()
self
.
dico
.
pop
(
"
temp_directory
"
)
self
.
dico
.
pop
(
"
temp_directory
"
)
with
open
(
f
"
{
self
.
workflow
.
get_output_dir
()
}
/ro-crate-metadata-
{
self
.
workflow
.
get_name
()
}
.json
"
,
'
w
'
)
as
output_file
:
name
=
self
.
workflow
.
get_name
()
name
=
name
.
replace
(
'
github.com/
'
,
''
)
name
=
re
.
sub
(
r
"
^[ .]|[/<>:\"\\|?*]+|[ .]$
"
,
"
-
"
,
name
)
with
open
(
f
"
{
self
.
workflow
.
get_output_dir
()
}
/ro-crate-metadata-
{
name
}
.json
"
,
'
w
'
)
as
output_file
:
json
.
dump
(
self
.
dico
,
output_file
,
indent
=
2
)
json
.
dump
(
self
.
dico
,
output_file
,
indent
=
2
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/test_cli.py
+
9
−
1
View file @
d9a06fcf
...
@@ -6,7 +6,6 @@ from bioflow_insight_cli.main import cli
...
@@ -6,7 +6,6 @@ from bioflow_insight_cli.main import cli
class
TestCall
(
unittest
.
TestCase
):
class
TestCall
(
unittest
.
TestCase
):
def
test_cli_works
(
self
):
def
test_cli_works
(
self
):
cli
(
"
./wf_test/main.nf
"
,
render_graphs
=
True
)
cli
(
"
./wf_test/main.nf
"
,
render_graphs
=
True
)
cli
(
"
./wf_test/main.nf
"
,
render_graphs
=
False
)
cli
(
"
./wf_test/main.nf
"
,
render_graphs
=
False
)
...
@@ -18,3 +17,12 @@ class TestCall(unittest.TestCase):
...
@@ -18,3 +17,12 @@ class TestCall(unittest.TestCase):
cli
(
"
./wf_test/main.nf
"
,
render_graphs
=
False
,
output_dir
=
str
(
my_results
))
cli
(
"
./wf_test/main.nf
"
,
render_graphs
=
False
,
output_dir
=
str
(
my_results
))
self
.
assertTrue
(
my_results
.
exists
(),
"
Results should be there, output_dir not taken into account
"
)
self
.
assertTrue
(
my_results
.
exists
(),
"
Results should be there, output_dir not taken into account
"
)
def
test_with_illegal_path_char_in_name
(
self
):
with
TemporaryDirectory
()
as
my_temp_dir
:
my_results
=
pathlib
.
Path
(
my_temp_dir
)
/
"
my_results
"
cli
(
"
./wf_test/main.nf
"
,
render_graphs
=
False
,
output_dir
=
str
(
my_results
),
name
=
"
https://github.com/blabla/toto:qsd!qsd%#sqdqsd
"
)
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