mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-06 08:19:45 +08:00
group exceptions to 2 types: failure and error
This commit is contained in:
@@ -8,6 +8,7 @@ This module handles import compatibility issues between Python 2 and
|
||||
Python 3.
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
# -------
|
||||
@@ -23,10 +24,6 @@ is_py2 = (_ver[0] == 2)
|
||||
#: Python 3.x?
|
||||
is_py3 = (_ver[0] == 3)
|
||||
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
# ---------
|
||||
# Specifics
|
||||
@@ -42,6 +39,9 @@ if is_py2:
|
||||
numeric_types = (int, long, float)
|
||||
integer_types = (int, long)
|
||||
|
||||
FileNotFoundError = IOError
|
||||
JSONDecodeError = json.decoder.JSONDecodeError
|
||||
|
||||
elif is_py3:
|
||||
from collections import OrderedDict
|
||||
|
||||
@@ -51,3 +51,6 @@ elif is_py3:
|
||||
basestring = (str, bytes)
|
||||
numeric_types = (int, float)
|
||||
integer_types = (int,)
|
||||
|
||||
FileNotFoundError = FileNotFoundError
|
||||
JSONDecodeError = ValueError
|
||||
|
||||
Reference in New Issue
Block a user