Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3BUU
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
Package Registry
Container 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
simulation
KM3BUU
Commits
1fb42254
Commit
1fb42254
authored
5 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for run by jobcard file
parent
787c2fbe
No related branches found
No related tags found
1 merge request
!1
Merge python environment
Pipeline
#9398
passed
5 years ago
Stage: test
Stage: coverage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3buu/ctrl.py
+1
-1
1 addition, 1 deletion
km3buu/ctrl.py
km3buu/tests/test_ctrl.py
+18
-1
18 additions, 1 deletion
km3buu/tests/test_ctrl.py
with
19 additions
and
2 deletions
km3buu/ctrl.py
+
1
−
1
View file @
1fb42254
...
...
@@ -59,7 +59,7 @@ def run_jobcard(jobcard, outdir):
with
open
(
jobcard_fpath
,
'
w
'
)
as
f
:
f
.
write
(
str
(
jobcard
))
elif
isfile
(
jobcard
):
os
.
system
(
"
cp %s %s
"
%
(
jobcard
,
jobcard_fpath
.
name
))
os
.
system
(
"
cp %s %s
"
%
(
jobcard
,
jobcard_fpath
))
else
:
log
.
error
(
"
No valid jobcard reference given: %s
"
%
jobcard
)
log
.
info
(
"
Create temporary file for associated runscript
"
)
...
...
This diff is collapsed.
Click to expand it.
km3buu/tests/test_ctrl.py
+
18
−
1
View file @
1fb42254
...
...
@@ -16,10 +16,27 @@ from km3buu.jobcard import *
from
km3buu.ctrl
import
run_jobcard
from
tempfile
import
TemporaryDirectory
from
os
import
listdir
from
os.path
import
abspath
,
join
,
dirname
from
thepipe.logger
import
get_logger
JOBCARD_FOLDER
=
abspath
(
join
(
dirname
(
__file__
),
"
../../jobcards
"
))
class
TestCTRL
(
unittest
.
TestCase
):
class
TestCTRLbyJobcardFile
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
filename
=
join
(
JOBCARD_FOLDER
,
"
examples/example.job
"
)
self
.
output_dir
=
TemporaryDirectory
()
self
.
retval
=
run_jobcard
(
self
.
filename
,
self
.
output_dir
.
name
)
def
test_output
(
self
):
assert
self
.
retval
==
0
def
test_output_files_existing
(
self
):
files
=
listdir
(
self
.
output_dir
.
name
)
assert
"
FinalEvents.dat
"
in
files
class
TestCTRLbyJobcardObject
(
unittest
.
TestCase
):
def
setUp
(
self
):
log
=
get_logger
(
"
ctrl.py
"
)
log
.
setLevel
(
"
INFO
"
)
...
...
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