Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions spinnaker_testbase/base_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,13 @@ def assert_logs_messages(
def get_system_iobuf_files(self) -> List[str]:
"""
Get a list of the system iobuf files.

:rtype: list(str)
"""
system_iobuf_file_path = FecDataView.get_system_provenance_dir_path()
return os.listdir(system_iobuf_file_path)

def get_app_iobuf_files(self) -> List[str]:
"""
Get a list of the application iobuf files.

:rtype: list(str)
"""
app_iobuf_file_path = FecDataView.get_app_provenance_dir_path()
return os.listdir(app_iobuf_file_path)
6 changes: 2 additions & 4 deletions spinnaker_testbase/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ def ping(ip_address: str) -> int:
Send a ping (ICMP ECHO request) to the given host.
SpiNNaker boards support ICMP ECHO when booted.

:param str ip_address:
:param ip_address:
The IP address to ping. Hostnames can be used, but are not
recommended.
:return:
return code of subprocess; 0 for success, anything else for failure
:rtype: int
"""
if platform.platform().lower().startswith("windows"):
cmd = "ping -n 1 -w 1 "
Expand All @@ -61,10 +60,9 @@ def host_is_reachable(ip_address: str) -> bool:
This information may be cached in various ways. Transient failures
are not necessarily detected or recovered from.

:param str ip_address:
:param ip_address:
The IP address to ping. Hostnames can be used, but are not
recommended.
:rtype: bool
"""
if ip_address in Ping.unreachable:
return False
Expand Down
25 changes: 11 additions & 14 deletions spinnaker_testbase/root_script_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class RootScriptBuilder(object):
def add_script(self, test_file: TextIOBase, name: str, local_path: str,
skip_imports: Optional[List[str]]) -> None:
"""
:param io.TextIOBase test_file:
:param str name:
:param str local_path:
:param list(str) skip_imports:
:param test_file:
:param name:
:param local_path:
:param skip_imports:
"""
test_file.write("\n def test_")
test_file.write(name)
Expand All @@ -62,12 +62,12 @@ def add_scripts(self, a_dir: str, prefix_len: int, test_file: TextIOBase,
too_long: Dict[str, str], exceptions: Dict[str, str],
skip_exceptions: Dict[str, List[str]]) -> None:
"""
:param str a_dir:
:param int prefix_len:
:param io.TextIOBase test_file:
:param dict(str,str) too_long:
:param dict(str,str) exceptions:
:param dict(str,list(str)) skip_exceptions:
:param a_dir:
:param prefix_len:
:param test_file:
:param too_long:
:param exceptions:
:param skip_exceptions:
"""
for a_script in os.listdir(a_dir):
script_path = os.path.join(a_dir, a_script)
Expand Down Expand Up @@ -108,18 +108,15 @@ def create_test_scripts(
"""
:param dirs: List of dirs to find scripts in.
These are relative paths to the repository
:type dirs: str or list(str)
:param too_long: Dict of files that take too long to run and how long.
These are just the file name including the `.py`.
They are mapped to a skip reason.
These are only skip tests if asked to be (currently not done).
:type too_long: dict(str, str) or None
:param exceptions: Dict of files that should be skipped.
These are just the file name including the `.py`.
They are mapped to a skip reason.
These are always skipped.
:type exceptions: dict(str, str) or None
:param dict(str,list(str)) skip_exceptions:
:param skip_exceptions:
Dict of files and exceptions to skip on.
These are just the file name including the `.py`.
They are mapped to a list of INDIVIUAL import statements
Expand Down
9 changes: 4 additions & 5 deletions spinnaker_testbase/root_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def report(self, message: str, file_name: str) -> None:
If no GLOBAL_REPORTS is defined the timestamp directory
holding the run data is used.

:param str message:
:param str file_name: local file name.
:param message:
:param file_name: local file name.
"""
if not message.endswith("\n"):
message += "\n"
Expand All @@ -104,11 +104,10 @@ def runsafe(self, method: Callable, retry_delay: float = 3.0,
"""
Will run the method possibly a few times

:param callable method:
:param float retry_delay:
:param method:
:param retry_delay:
:param skip_exceptions:
list of exception classes to convert in SkipTest
:type skip_exceptions: list(class)
"""
if skip_exceptions is None:
skip_exceptions = []
Expand Down
5 changes: 2 additions & 3 deletions spinnaker_testbase/script_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ def _script_path(self, script: str) -> str:
def check_script(self, script: str, broken_msg: Optional[str] = None,
skip_exceptions: Optional[List[type]] = None) -> None:
"""
:param str script: relative path to the file to run
:param str broken_msg:
:param script: relative path to the file to run
:param broken_msg:
message to print instead of raising an exception;
no current use-case known
:param skip_exceptions:
list of exception classes to convert in SkipTest
:type skip_exceptions: list(type) or None
"""
# pylint: disable=global-statement
global script_checker_shown
Expand Down
37 changes: 37 additions & 0 deletions unittests/test_doc_checker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2017 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 sys
import unittest

from spinn_utilities.config_setup import unittest_setup
from spinn_utilities.testing.docs_checker import DocsChecker


class TestCfgChecker(unittest.TestCase):

def setUp(self) -> None:
unittest_setup()

def test_doc_checks(self) -> None:
class_file = sys.modules[self.__module__].__file__
assert class_file is not None
abs_class_file = os.path.abspath(class_file)
unittest_dir = os.path.dirname(abs_class_file)
repo_dir = os.path.dirname(unittest_dir)
checker = DocsChecker(
check_init=False, check_short=False, check_params=False)
checker.check_dir(repo_dir)
checker.check_no_errors()
Loading