Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
25ced1ba
Commit
25ced1ba
authored
Apr 21, 2020
by
niklas.baumgarten
Browse files
updated python experiments
parent
e7c056cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
python/test_experiments.py
View file @
25ced1ba
from
unittest
import
TestCase
,
main
from
unittest
import
TestCase
,
main
import
time
import
sys
import
sys
import
os
import
os
...
@@ -10,20 +11,39 @@ from mlmc_mppy import mpp
...
@@ -10,20 +11,39 @@ from mlmc_mppy import mpp
class
TestExperiments
(
TestCase
):
class
TestExperiments
(
TestCase
):
@
classmethod
@
classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
mpp
.
mute
=
False
mpp
.
clean_cmake_cache
()
mpp
.
build
()
mpp
.
build
()
@
classmethod
@
classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
# mpp.clean_build()
pass
pass
def
setUp
(
self
):
def
setUp
(
self
):
mpp
.
reset_sol_data
()
mpp
.
clean_data
()
mpp
.
clean_data
()
self
.
startTime
=
time
.
time
()
def
tearDown
(
self
):
def
tearDown
(
self
):
t
=
time
.
time
()
-
self
.
startTime
self
.
show_timing
(
t
)
mpp
.
kill
()
mpp
.
reset_sol_data
()
mpp
.
clean_data
()
mpp
.
clean_data
()
def
show_timing
(
self
,
t
):
unit
=
's'
if
t
>=
60
:
t
=
t
/
60.0
unit
=
'min'
if
t
>=
60
:
t
=
t
/
60.0
unit
=
'h'
test_id
=
self
.
id
().
replace
(
'__main__.'
,
''
)
# 64 is length of dashed line minus the print accuracy of 6 digits
space
=
(
64
-
len
(
test_id
)
-
len
(
unit
))
*
' '
print
(
'{}{}{:6.3f}{}'
.
format
(
test_id
,
space
,
t
,
unit
))
class
TestEllipticBasics
(
TestExperiments
):
class
TestEllipticBasics
(
TestExperiments
):
def
test_git_repo
(
self
):
def
test_git_repo
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment