Skip to content

Commit

Permalink
new way to get writer in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Jan 6, 2022
1 parent 8a4ffff commit f5a98dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 4 additions & 8 deletions unittests/data/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,22 @@ def setUp(cls):

def test_setup(self):
view = SpiNNManDataView()
writer = SpiNNManDataWriter()
# What happens before setup depends on the previous test
# Use manual_check to verify this without dependency
writer.setup()
SpiNNManDataWriter.setup()
with self.assertRaises(DataNotYetAvialable):
view.transceiver

def test_mock(self):
view = SpiNNManDataView()
writer = SpiNNManDataWriter()
writer.mock()
SpiNNManDataWriter.mock()
# check there is a
# value not what it is
view.machine

def test_transceiver(self):
view = SpiNNManDataView()
writer = SpiNNManDataWriter()
writer.setup()
writer = SpiNNManDataWriter.setup()
with self.assertRaises(DataNotYetAvialable):
view.transceiver
self.assertFalse(view.has_transceiver())
Expand All @@ -69,8 +66,7 @@ def test_transceiver(self):

def test_app_id_tracker(self):
view = SpiNNManDataView()
writer = SpiNNManDataWriter()
writer.setup()
writer = SpiNNManDataWriter.setup()
self.assertIsNotNone(view.app_id_tracker)
# result happens to be 17 but if it chages change test
self.assertEqual(17, view.get_new_id())
Expand Down
3 changes: 1 addition & 2 deletions unittests/test_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def test_retrieving_machine_details(self):

assert trans.is_connected()
print(trans.get_scamp_version())
SpiNNManDataWriter().set_machine(trans.get_machine_details())
print(trans.get_cpu_information())

def test_boot_board(self):
Expand Down Expand Up @@ -158,7 +157,7 @@ def test_set_watch_dog(self):
connections.append(SCAMPConnection(
remote_host=None))
tx = MockWriteTransceiver(version=5, connections=connections)
SpiNNManDataWriter().set_machine(tx.get_machine_details())
SpiNNManDataWriter.mock().set_machine(tx.get_machine_details())
# All chips
tx.set_watch_dog(True)
tx.set_watch_dog(False)
Expand Down

0 comments on commit f5a98dd

Please sign in to comment.