Skip to content

Commit

Permalink
first test
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed May 14, 2024
1 parent cdfc5e4 commit 0b0a806
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ jobs:
cover-packages: spinnman
coveralls-token: ${{ secrets.GITHUB_TOKEN }}

- name: Integration tests
uses: ./support/actions/pytest
env:
SPALLOC_USER: ${{ secrets.SPALLOC_USER }}
SPALLOC_PASSWORD: ${{ secrets.SPALLOC_PASSWORD }}
with:
tests: spinnman_integration_tests
coverage: ${{ matrix.python-version == 3.12 }}
cover-packages: spinnman
coveralls-token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint with flake8
run: flake8 spinnman unittests
- name: Lint with pylint
Expand Down
13 changes: 13 additions & 0 deletions spinnman_integration_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2024 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
60 changes: 60 additions & 0 deletions spinnman_integration_tests/test_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright (c) 2024 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import unittest

from spinn_utilities.config_holder import set_config

from spinn_machine.version import FIVE
from spinnman.config_setup import unittest_setup
from spinnman.spalloc import SpallocClient

class TestTransceiver(unittest.TestCase):

def setUp(self):
unittest_setup()
set_config("Machine", "version", FIVE)
self.spalloc_url = "https://spinnaker.cs.man.ac.uk/spalloc"
self.spalloc_machine = "SpiNNaker1M"
a = os.environ
self.spalloc_user = os.environ["SPALLOC_USER"]
self.spalloc_password = os.environ["SPALLOC_PASSWORD"]

def test_create_job(self):
client = SpallocClient(
self.spalloc_url, self.spalloc_user, self.spalloc_password)
# job = client.create_job_rect_at_board(
# WIDTH, HEIGHT, triad=(x, y, b), machine_name=SPALLOC_MACHINE,
# max_dead_boards=1)
job = client.create_job(
num_boards=2, machine_name=self.spalloc_machine)
with job:
job.launch_keepalive_task()
job.wait_until_ready()

print(job.get_connections())
connections = job.get_connections()
self.assertGreaterEqual(len(connections), 2)
self.assertIn((0,0), connections)
txrx = job.create_transceiver()
dims = txrx._get_machine_dimensions()
# May be 12 as we only asked for 2 boards
self.assertGreaterEqual(dims.height, 12)
self.assertGreaterEqual(dims.width, 12)

client.close() # print(2^(1/(2^1)

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

0 comments on commit 0b0a806

Please sign in to comment.