From 9930d6d4372251ede6f2d0870f4d2a08b185f0e5 Mon Sep 17 00:00:00 2001 From: Nicolas KAROLAK <nicolas@karolak.fr> Date: Sat, 27 Apr 2019 08:30:04 +0200 Subject: [PATCH] compat for python3.5 --- tests/test_nginx_vhosts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_nginx_vhosts.py b/tests/test_nginx_vhosts.py index 0836c81d..d8828e1b 100755 --- a/tests/test_nginx_vhosts.py +++ b/tests/test_nginx_vhosts.py @@ -44,7 +44,7 @@ def get_vhosts(config: Path) -> list: # capture server blocks servers = re.compile(r"^server\s+{(?:\s*(?!server\s{).)+", re.M) - with open(config) as config_fo: + with open(str(config)) as config_fo: config_content = sanitize.sub(r"", config_fo.read()) vhosts = servers.findall(config_content) @@ -58,7 +58,7 @@ def get_hostnames(vhost: str) -> list: hostnames = [] for line in vhost.splitlines(): if server_names.match(line): - hostnames.extend(server_names.match(line)[1].split()) + hostnames.extend(server_names.match(line).group(1).split()) return hostnames @@ -71,7 +71,7 @@ def get_ports(vhost: str) -> list: for line in vhost.splitlines(): if listens.match(line): ports.append( - (listens.match(line)[1], "https" if listens.match(line)[2] else "http") + (listens.match(line).group(1), "https" if listens.match(line).group(2) else "http") ) return ports -- GitLab