Skip to content

Commit

Permalink
Add Testbed.start() & Testbed.stop() for use within a notebook
Browse files Browse the repository at this point in the history
Signed-off-by: James Noss <jnoss@stsci.edu>
  • Loading branch information
jamienoss committed Feb 19, 2022
1 parent c4376f5 commit be2d75a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions catkit/testbed/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, safety_tests, output_path=None, suffix=None,
for test in safety_tests:
self.safety_tests.append(test())

def __enter__(self):
def start(self):
try:
self._setup()

Expand Down Expand Up @@ -125,9 +125,15 @@ def __enter__(self):
finally:
raise

def stop(self):
return self._teardown()

def __enter__(self):
return self.start()

def __exit__(self, exc_type, exc_val, exc_tb):
try:
self._teardown()
self.stop()
finally:
if exc_type:
self.log.exception("The testbed encountered the following error(s):")
Expand Down

0 comments on commit be2d75a

Please sign in to comment.