Skip to content

Commit ba640e8

Browse files
committed
fixtures: Avoid overly broad exception clause
1 parent ad09bf6 commit ba640e8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytest_flask/fixtures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import socket
77

88
try:
9-
from urllib2 import urlopen
9+
from urllib2 import URLError, urlopen
1010
except ImportError:
11+
from urllib.error import URLError
1112
from urllib.request import urlopen
1213

1314
from flask import _request_ctx_stack
@@ -72,7 +73,7 @@ def worker(app, port):
7273
try:
7374
urlopen(self.url())
7475
timeout = 0
75-
except:
76+
except URLError:
7677
timeout -= 1
7778

7879
def url(self, url=''):

0 commit comments

Comments
 (0)