Skip to content

Commit

Permalink
Merge pull request #730 from ellert/warn-test-fix
Browse files Browse the repository at this point in the history
Fix warning test
  • Loading branch information
minrk committed Jun 30, 2022
2 parents 367cd36 + ee49406 commit 6bc6d94
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ipyparallel/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,23 +626,25 @@ def test_warning_on_hostname_match(self):
c = self.connect_client()
c.close()
with mock.patch('socket.gethostname', lambda: location):
c = None
try:
c = self.connect_client()
with warnings.catch_warnings():
warnings.simplefilter("error", category=RuntimeWarning)
c = self.connect_client()
finally:
if c:
warnings.simplefilter("ignore", category=RuntimeWarning)
c.close()

def test_local_ip_true_doesnt_trigger_warning(self):
with mock.patch('ipyparallel.client.client.is_local_ip', lambda x: True):
c = None
with warnings.catch_warnings():
warnings.simplefilter("error")
try:
try:
with warnings.catch_warnings():
warnings.simplefilter("error", category=RuntimeWarning)
c = self.connect_client()
finally:
if c:
c.close()
finally:
if c:
c.close()

def test_wait_for_engines(self):
n = len(self.client)
Expand Down

0 comments on commit 6bc6d94

Please sign in to comment.