1
|
|
|
import unittest |
2
|
|
|
from synergine.core.Core import Core |
3
|
|
|
from synergine.test.TestTerminal import TestTerminal |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
class TestSimulation(unittest.TestCase): |
7
|
|
|
def setUp(self): |
8
|
|
|
self._connection = TestTerminal |
9
|
|
|
|
10
|
|
|
def _get_set_up_simulations(self): |
11
|
|
|
raise NotImplementedError |
12
|
|
|
|
13
|
|
|
def _get_core_configuration(self, cycles, main_process=True): |
14
|
|
|
return { |
15
|
|
|
'engine': { |
16
|
|
|
'fpsmax': True, |
17
|
|
|
'debug': { |
18
|
|
|
'mainprocess': main_process, |
19
|
|
|
'cycles': cycles, |
20
|
|
|
'seed': 42 |
21
|
|
|
} |
22
|
|
|
}, |
23
|
|
|
'simulations': self._get_set_up_simulations(), |
24
|
|
|
'connections': [self._connection] |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
def get_core(self, cycles=0, main_process=True, modules=None): |
28
|
|
|
# |
29
|
|
|
# |
30
|
|
|
core = Core(self._get_core_configuration(cycles, main_process), modules) |
31
|
|
|
have_to_be_runned_by = core.have_to_be_runned_by() |
32
|
|
|
if have_to_be_runned_by: |
33
|
|
|
have_to_be_runned_by.encapsulate_run(core.run) |
34
|
|
|
return core |
35
|
|
|
|
36
|
|
|
def _get_synergy_object_manager_for_cycle(self, cycles, main_process=True, modules=None): |
|
|
|
|
37
|
|
|
core = self._run_and_get_core(cycles, main_process, modules=modules) |
38
|
|
|
return core.get_terminal(self._connection.get_name()).get_synergy_object_manager() |
39
|
|
|
|
40
|
|
|
def _run_and_get_core(self, cycles, main_process=True, modules=None): |
41
|
|
|
core = self.get_core(cycles, main_process, modules=modules) |
42
|
|
|
core.run() |
43
|
|
|
return core |
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.