Skip to content

Commit 394c076

Browse files
committed
Remove TimeoutError workaround for Python 2
1 parent 3e09bed commit 394c076

2 files changed

Lines changed: 2 additions & 18 deletions

File tree

tests/ssg_test_suite/oscap.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
import logging
77
import os.path
88
import re
9-
import socket
10-
import subprocess
11-
import sys
129
import time
1310
import xml.etree.ElementTree
1411

@@ -20,12 +17,6 @@
2017

2118
from ssg.shims import input_func
2219

23-
# Needed for compatibility as there is no TimeoutError in python2.
24-
if sys.version_info[0] < 3:
25-
TimeoutException = socket.timeout
26-
else:
27-
TimeoutException = TimeoutError
28-
2920
logging.getLogger(__name__).addHandler(logging.NullHandler())
3021

3122
_CONTEXT_RETURN_CODES = {'pass': 0,
@@ -684,7 +675,7 @@ def test_target(self):
684675
logging.info("Terminating the test run due to keyboard interrupt.")
685676
except RuntimeError as exc:
686677
logging.error("Terminating due to error: {msg}.".format(msg=str(exc)))
687-
except TimeoutException as exc:
678+
except TimeoutError as exc:
688679
logging.error("Terminating due to timeout: {msg}".format(msg=str(exc)))
689680
finally:
690681
self.finalize()

tests/ssg_test_suite/virt.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22

33
import logging
44
import socket
5-
import sys
65
import time
76
import xml.etree.ElementTree as ET
87

98
import libvirt
109

11-
# Needed for compatibility as there is no TimeoutError in python2.
12-
if sys.version_info[0] < 3:
13-
TimeoutException = socket.timeout
14-
else:
15-
TimeoutException = TimeoutError
16-
1710
logging.getLogger(__name__).addHandler(logging.NullHandler())
1811

1912

@@ -201,7 +194,7 @@ def reboot_domain(domain, domain_ip, ssh_port):
201194
str_err = ("Timeout reached: '{0}' ({1}:{2}) domain does not "
202195
"accept connections.".format(domain.name(), domain_ip, ssh_port))
203196
logging.debug(str_err)
204-
raise TimeoutException(str_err)
197+
raise TimeoutError(str_err)
205198
else:
206199
ssh_socket.close()
207200
break

0 commit comments

Comments
 (0)