Commit 25ced1ba authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

updated python experiments

parent e7c056cd
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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment