Skip to content

Commit

Permalink
Merge branch 'master' into split_synapse_neuron_models
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgait committed Jun 23, 2021
2 parents b6ce15e + 8c5573b commit d445e7c
Show file tree
Hide file tree
Showing 56 changed files with 205 additions and 119 deletions.
4 changes: 2 additions & 2 deletions pacman/config_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
BASE_CONFIG_FILE = "pacman.cfg"


def reset_configs():
def unittest_setup():
"""
Resets the configs so only the local default config is included.
.. note::
This file should only be called from PACMAN/unittests
"""
clear_cfg_files()
clear_cfg_files(True)
add_pacman_cfg()


Expand Down
4 changes: 4 additions & 0 deletions pacman_integration_tests/test_big_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import sys
import unittest

from pacman.config_setup import unittest_setup
from pacman.model.routing_tables.multicast_routing_tables import (from_json)
from pacman.operations.router_compressors.routing_compression_checker import (
compare_tables)
Expand All @@ -30,6 +31,9 @@

class TestBigCompression(unittest.TestCase):

def setUp(self):
unittest_setup()

def test_big(self):
class_file = sys.modules[self.__module__].__file__
path = os.path.dirname(os.path.abspath(class_file))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.executor.algorithm_classes import PythonClassAlgorithm


Expand All @@ -22,6 +23,9 @@ class TestPythonClassAlgorithm(unittest.TestCase):
tests which test the application graph object
"""

def setUp(self):
unittest_setup()

def test_python_class(self):
python_module = "Foo"
python_class = "Bar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.executor.algorithm_classes import PythonFunctionAlgorithm


Expand All @@ -22,6 +23,9 @@ class TestPythonFunctionAlgorithm(unittest.TestCase):
tests which test the application graph object
"""

def setUp(self):
unittest_setup()

def test_python_module(self):
python_module = "Foo"
python_function = "bar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman_test_objects import SimpleTestEdge, SimpleTestVertex


Expand All @@ -22,6 +23,9 @@ class TestApplicationEdgeModel(unittest.TestCase):
tests which test the application graph object
"""

def setUp(self):
unittest_setup()

def test_create_new_edge(self):
"""
test that you can create a edge between two vertices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanConfigurationException
from pacman.model.graphs.application import ApplicationGraphView
from pacman.model.graphs.application import ApplicationEdge, ApplicationGraph
Expand All @@ -25,6 +26,9 @@ class TestApplicationGraphModel(unittest.TestCase):
tests which test the application graph object
"""

def setUp(self):
unittest_setup()

def test_create_new_empty_graph(self):
ApplicationGraph("foo")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import numpy
import unittest
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanInvalidParameterException
from pacman.model.constraints.partitioner_constraints import (
MaxVertexAtomsConstraint)
Expand All @@ -28,6 +29,10 @@ class TestApplicationGraphModel(unittest.TestCase):
"""
tests which test the application graph object
"""

def setUp(self):
unittest_setup()

def test_create_new_vertex(self):
"""
test initialisation of a vertex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""
import unittest

from pacman.config_setup import unittest_setup
from pacman.model.graphs.application import ApplicationGraph
from pacman.model.graphs.common import Slice
from pacman.model.graphs.machine import MachineEdge, SimpleMachineVertex, \
Expand All @@ -30,6 +31,9 @@ class TestGraphMapping(unittest.TestCase):
graph mapper tests
"""

def setUp(self):
unittest_setup()

def test_get_edges_from_edge(self):
"""
test getting the edges from a graph mapper from a edge
Expand Down
4 changes: 4 additions & 0 deletions unittests/model_tests/graph_mapper_tests/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
tests for slice
"""
import unittest
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanValueError
from pacman.model.graphs.common import Slice

Expand All @@ -26,6 +27,9 @@ class TestSliceFunctions(unittest.TestCase):
slice function tests
"""

def setUp(self):
unittest_setup()

def test_create_slice_valid(self):
"""
test creating a empty slice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.model.graphs.application import ApplicationGraph
from pacman.model.graphs.common import EdgeTrafficType
from pacman.model.graphs.machine import (
Expand All @@ -31,6 +32,9 @@ class TestMachineGraphModel(unittest.TestCase):
Tests that test the functionality of the machine graph object
"""

def setUp(self):
unittest_setup()

def test_new_vertex(self):
"""
test the creation of a machine vertex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import unittest
from testfixtures import LogCapture
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanConfigurationException
from pacman.model.partitioner_splitters import SplitterSliceLegacy
from pacman_test_objects import (
Expand All @@ -25,6 +26,9 @@ class TestSplitterSliceLegacy(unittest.TestCase):
""" Tester for pacman.model.constraints.placer_constraints
"""

def setUp(self):
unittest_setup()

def test_no_api(self):
splitter = SplitterSliceLegacy()
vertex = NonLegacyApplicationVertex()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.model.constraints.placer_constraints import (
BoardConstraint, ChipAndCoreConstraint, RadialPlacementFromChipConstraint,
SameChipAsConstraint)
Expand All @@ -24,6 +25,9 @@ class TestPlacementConstraints(unittest.TestCase):
""" Tester for pacman.model.constraints.placer_constraints
"""

def setUp(self):
unittest_setup()

def test_board_constraint(self):
c1 = BoardConstraint("1.2.3.4")
self.assertEqual(c1.board_address, "1.2.3.4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
tests for placement
"""
import unittest
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanAlreadyPlacedError
from pacman.model.graphs.machine import SimpleMachineVertex
from pacman.model.placements import Placement, Placements
Expand All @@ -27,6 +28,9 @@ class TestPlacement(unittest.TestCase):
tester for placement object in pacman.model.placements.placement
"""

def setUp(self):
unittest_setup()

def test_create_new_placement(self):
"""
test that creating a new placement puts stuff in the right place
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
tests for placements
"""
import unittest
from pacman.config_setup import unittest_setup
from pacman.model.graphs.machine import SimpleMachineVertex
from pacman.model.placements import Placement, Placements

Expand All @@ -26,6 +27,9 @@ class TestPlacements(unittest.TestCase):
tester for placements object in pacman.model.placements.placements
"""

def setUp(self):
unittest_setup()

def test_create_new_placements(self):
"""
test creating a placements object
Expand Down
4 changes: 4 additions & 0 deletions unittests/model_tests/resources_tests/test_resources_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from enum import Enum
import tempfile
import unittest
from pacman.config_setup import unittest_setup
from pacman.model.resources import (
ConstantSDRAM, CPUCyclesPerTickResource, DTCMResource, ResourceContainer,
IPtagResource, MultiRegionSDRAM, ReverseIPtagResource,
Expand All @@ -36,6 +37,9 @@ class TestResourceModels(unittest.TestCase):
unit tests on the resources object
"""

def setUp(self):
unittest_setup()

def test_sdram(self):
"""
test that adding a SDRAM resource to a resource container works
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest

from pacman.config_setup import unittest_setup
from pacman.model.graphs.machine import MulticastEdgePartition
from pacman.model.resources import ResourceContainer
from pacman.exceptions import (
Expand All @@ -28,6 +28,9 @@

class TestRoutingInfo(unittest.TestCase):

def setUp(self):
unittest_setup()

def test_routing_info(self):
# mock to avoid having to create a graph for this test
graph_code = 123
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest

from pacman.config_setup import unittest_setup
from pacman.model.graphs.machine import MulticastEdgePartition
from spinn_machine import MulticastRoutingEntry
from pacman.model.routing_tables import (
Expand All @@ -32,6 +32,10 @@ class TestRoutingTable(unittest.TestCase):
"""
tests for the routing table object
"""

def setUp(self):
unittest_setup()

def test_new_multicast_routing_table_entry(self):
"""
test that creating a multicast routing entry works
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanConfigurationException
from pacman.model.graphs.application.abstract import (
AbstractOneAppOneMachineVertex)
Expand All @@ -22,6 +23,10 @@


class TestSplitterOneAppOneMachine(unittest.TestCase):

def setUp(self):
unittest_setup()

def test_legacy(self):
splitter = SplitterOneAppOneMachine("foo")
v1 = NonLegacyApplicationVertex("v1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanConfigurationException
from pacman.model.partitioner_splitters import SplitterSliceLegacy
from pacman_test_objects import (
DuckLegacyApplicationVertex, NonLegacyApplicationVertex, SimpleTestVertex)


class TestSplitterSliceLegacy(unittest.TestCase):

def setUp(self):
unittest_setup()

def test_api(self):
splitter = SplitterSliceLegacy("foo")
a = str(splitter)
Expand Down
4 changes: 4 additions & 0 deletions unittests/model_tests/tag_tests/test_tag_infos_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""
import unittest
from spinn_machine.tags import IPTag, ReverseIPTag
from pacman.config_setup import unittest_setup
from pacman.exceptions import PacmanInvalidParameterException
from pacman.model.graphs.machine import SimpleMachineVertex
from pacman.model.tags import Tags
Expand All @@ -28,6 +29,9 @@ class TestTagsModel(unittest.TestCase):
test that the tags object works as expected
"""

def setUp(self):
unittest_setup()

def test_new_tag_info(self):
"""
test that creating a empty tag object works
Expand Down
5 changes: 5 additions & 0 deletions unittests/model_tests/test_key_allocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
from pacman.config_setup import unittest_setup
from pacman.model.routing_info import BaseKeyAndMask
from pacman.utilities.utility_objs import Field
from pacman.model.constraints.key_allocator_constraints import (
Expand All @@ -22,6 +23,10 @@


class TestKeyAllocatorConstraints(unittest.TestCase):

def setUp(self):
unittest_setup()

def test_contiguous_key_range_constraint(self):
c1 = ContiguousKeyRangeContraint()
c2 = ContiguousKeyRangeContraint()
Expand Down
Loading

0 comments on commit d445e7c

Please sign in to comment.