Skip to content

Commit

Permalink
tests: fix unclosed ssl socket warnings
Browse files Browse the repository at this point in the history
Fix all but one that it's still pending
  • Loading branch information
ivotron committed Sep 22, 2020
1 parent a6fb842 commit 910eaa8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/popper/runner_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, **kw):
self._vol_claim_created = False

def __exit__(self, exc_type, exc_value, exc_traceback):
self._kclient.api_client.rest_client.pool_manager.clear()
self._kclient.api_client.close()
super(KubernetesRunner, self).__exit__(exc_type, exc_value, exc_traceback)
return True

Expand Down Expand Up @@ -477,3 +479,7 @@ class DockerRunner(KubernetesRunner, HostDockerRunner):

def __init__(self, **kw):
super(DockerRunner, self).__init__(**kw)

def __exit__(self, exc_type, exc_value, exc_traceback):
super(DockerRunner, self).__exit__(exc_type, exc_value, exc_traceback)
return True
12 changes: 3 additions & 9 deletions src/test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@ def tearDown(self):
log.setLevel("NOTSET")

def test_empty_file(self):
try:
f = open("test.yml", "a")
f.close()
WorkflowParser.parse(file="test.yml")
self.assertTrue(False, "Empty Workflow file does not raise an exception.")
except SystemExit:
self.assertTrue(True)
else:
self.assertTrue(False, "Empty Workflow file does not raise a SystemExit.")
with open("/tmp/test.yml", "w"):
pass
self.assertRaises(SystemExit, WorkflowParser.parse, **{"file": "/tmp/test.yml"})

def test_new_workflow(self):
wf_data = {}
Expand Down
2 changes: 2 additions & 0 deletions src/test/test_runner_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def setUp(self):
config.list_kube_config_contexts()

def tearDown(self):
self._kclient.api_client.rest_client.pool_manager.clear()
self._kclient.api_client.close()
log.setLevel("NOTSET")

def test_vol_claim_create_delete(self):
Expand Down

0 comments on commit 910eaa8

Please sign in to comment.