diff --git a/setup.py b/setup.py index f6c8eff3..3e5356c3 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ cmdclass = {} -install_requires = ['flexx >= 0.4.1', +install_requires = ['flexx == 0.4.1', 'future', 'normality == 0.6.1', 'dataset == 0.8'] @@ -26,7 +26,7 @@ 'tornado == 4.3'] -version = '0.9.7b0' +version = '0.9.7b1' setup(name='abcEconomics', diff --git a/unittest/buy.py b/unittest/buy.py index e0fdbedd..b079cb7c 100644 --- a/unittest/buy.py +++ b/unittest/buy.py @@ -35,10 +35,10 @@ def two(self): oo = self.get_offers('cookies') assert oo for offer in oo: - if random.randint(0, 10) == 0: + if self.time % 3 == 0: self.tests['not_answered'] = True continue - elif random.randint(0, 10) == 0: + elif self.time % 3 == 1: self.reject(offer) assert self['money'] == 0 assert self['cookies'] == cookies diff --git a/unittest/give.py b/unittest/give.py index 63223b56..c811acda 100644 --- a/unittest/give.py +++ b/unittest/give.py @@ -21,13 +21,12 @@ def one(self): def two(self): if self.id == 1: - rnd = random.randint(0, 1) - if rnd == 0: + if self.time % 2 == 0: msg = self.get_messages_all() msg = msg['tpc'] self.tests['all'] = True assert len(msg) == 1, len(msg) - elif rnd == 1: + elif self.time % 2 == 1: msg = self.get_messages('tpc') self.tests['topic'] = True assert len(msg) == 1, len(msg) diff --git a/unittest/sell.py b/unittest/sell.py index 2caee61a..1b3bf1c6 100644 --- a/unittest/sell.py +++ b/unittest/sell.py @@ -1,3 +1,4 @@ +import random import abcEconomics from tools import is_zero import random @@ -29,17 +30,17 @@ def two(self): oo = self.get_offers('cookies') assert oo, oo for offer in oo: - if random.randrange(0, 10) == 0: + if self.time % 4 == 0: self.tests['not_answered'] = True continue - elif random.randrange(0, 10) == 0: + elif self.time % 4 == 1: self.reject(offer) assert self['money'] == money assert self['cookies'] == 0 self.tests['rejected'] = True break # tests the automatic clean-up of polled offers try: - if random.randrange(2) == 0: + if self.time % 4 == 2: self.accept(offer) assert self['cookies'] == offer.quantity assert self['money'] == money - offer.quantity * offer.price diff --git a/unittest/start_core_engine.py b/unittest/start_core_engine.py index dd5044a3..1c796593 100644 --- a/unittest/start_core_engine.py +++ b/unittest/start_core_engine.py @@ -6,7 +6,7 @@ def main(processes, rounds): - s = Simulation(processes=processes, name='unittest') + s = Simulation(processes=processes, name='unittest', trade_logging='group') print('build Buy') buy = s.build_agents(Buy, 'buy', 1000, rounds=rounds) @@ -49,7 +49,7 @@ def main(processes, rounds): if __name__ == '__main__': - main(processes=1, rounds=3) + main(processes=1, rounds=20) print('Iteration with 1 core finished') - main(processes=2, rounds=3) + main(processes=2, rounds=20) print('Iteration with multiple processes finished')