Skip to content

Commit

Permalink
Merge pull request #240 from SpiNNakerManchester/raise_skiptest
Browse files Browse the repository at this point in the history
raise_skiptest method
  • Loading branch information
rowleya authored Oct 2, 2023
2 parents 8ecf29b + 3a0ab67 commit dd8f80d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spinn_utilities/data/utils_data_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import tempfile
from unittest import SkipTest
from .data_status import DataStatus
from .reset_status import ResetStatus
from .run_status import RunStatus
Expand Down Expand Up @@ -609,3 +610,26 @@ def _mock_has_run(cls):
cls.__data._reset_status = ResetStatus.HAS_RUN
cls.__data._requires_data_generation = False
cls.__data._requires_mapping = False

def raise_skiptest(self, reason=None, parent=None):
"""
Sets the status as shutdown amd raises a SkipTest
:param reason: Message for the exception is any
:type reason: Exception or None
:param parent: Exception which trggered the skip if any
:type reason: Exception or None
:raises: SkipTest very time called
"""
self.__data._data_status = DataStatus.SHUTDOWN
self.__data._run_status = RunStatus.SHUTDOWN
if reason is None:
if parent is None:
raise SkipTest()
else:
raise SkipTest() from parent
else:
if parent is None:
raise SkipTest(reason)
else:
raise SkipTest(reason) from parent

0 comments on commit dd8f80d

Please sign in to comment.