Skip to content

Commit

Permalink
Some changes with the parallel test
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Kraft committed Apr 14, 2021
1 parent 6a8a2a7 commit f3345d8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,33 @@
class TestParallel(unittest.TestCase):
@classmethod
def setUpClass(self):
# How many digits to match in case of floating point answers
self.tolerance = 7
#Create samplers for every algorithm:
self.rep = 21
self.timeout = 10 #Given in Seconds

# Set number of repititions (not to small)
self.rep = 200
self.timeout = 10 #Given in Seconds
self.dbformat = "ram"

def test_seq(self):
print('spotpy', spotpy.__version__, 'parallel=seq')
sampler=spotpy.algorithms.mc(spot_setup(),parallel='seq', dbname='Rosen', dbformat=self.dbformat, sim_timeout=self.timeout)
sampler.sample(self.rep)
results = sampler.getdata()
self.assertEqual(len(results), self.rep)

def test_mpc(self):
sampler=spotpy.algorithms.mc(spot_setup(),parallel='mpc', dbname='Rosen', dbformat=self.dbformat, sim_timeout=self.timeout)
print('spotpy', spotpy.__version__, 'parallel=mpc')
sampler = spotpy.algorithms.mc(spot_setup(),parallel='mpc', dbname='Rosen', dbformat=self.dbformat, sim_timeout=self.timeout)
sampler.sample(self.rep)
results = sampler.getdata()
self.assertEqual(len(results), self.rep)

def test_umpc(self):
print('spotpy', spotpy.__version__, 'parallel=umpc')
sampler=spotpy.algorithms.mc(spot_setup(),parallel='umpc', dbname='Rosen', dbformat=self.dbformat, sim_timeout=self.timeout)
sampler.sample(self.rep)
results = sampler.getdata()
self.assertEqual(len(results), self.rep)


if __name__ == '__main__':
unittest.main(exit=False)

0 comments on commit f3345d8

Please sign in to comment.