Skip to content

Commit

Permalink
Refactor pantsd integration test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
blorente committed Sep 18, 2018
1 parent 606fc83 commit 0aa8f83
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/python/pants_test/pantsd/pantsd_integration_test_base.py
Expand Up @@ -47,17 +47,23 @@ def _log(self):
def assert_started(self, timeout=.1):
self._process = None
self._pid = self.await_pid(timeout)
self.assert_running()
self._check_pantsd_is_alive()
return self._pid

def assert_running(self):
def _check_pantsd_is_alive(self):
self._log()
assert self._pid is not None and self.is_alive(), 'pantsd should be running!'
assert self._pid is not None and self.is_alive(), 'cannot assert that pantsd is running. Try calling assert_started before calling this method.'
return self._pid

def assert_running(self):
if not self._pid:
return self.assert_started()
else:
return self._check_pantsd_is_alive()

def assert_stopped(self):
self._log()
assert self._pid is not None, 'cant assert stoppage on an unknown pid!'
assert self._pid is not None, 'cannot assert pantsd stoppage. Try calling assert_started before calling this method.'
assert self.is_dead(), 'pantsd should be stopped!'
return self._pid

Expand Down

0 comments on commit 0aa8f83

Please sign in to comment.