mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 14:59:38 +08:00
change method of checking python version
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
from ate import utils, exception
|
from ate import utils, exception
|
||||||
|
|
||||||
try:
|
|
||||||
basestring # Python 2.x
|
|
||||||
except NameError:
|
|
||||||
basestring = str # Python 3.x
|
|
||||||
|
|
||||||
class ResponseObject(object):
|
class ResponseObject(object):
|
||||||
|
|
||||||
@@ -40,7 +36,7 @@ class ResponseObject(object):
|
|||||||
extract_binds_dict = {}
|
extract_binds_dict = {}
|
||||||
|
|
||||||
for key, value in extract_binds.items():
|
for key, value in extract_binds.items():
|
||||||
if not isinstance(value, basestring):
|
if not isinstance(value, utils.string_type):
|
||||||
raise exception.ParamsError("invalid extract_binds!")
|
raise exception.ParamsError("invalid extract_binds!")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ import yaml
|
|||||||
from ate.exception import ParamsError
|
from ate.exception import ParamsError
|
||||||
|
|
||||||
try:
|
try:
|
||||||
assert bytes is str
|
string_type = basestring
|
||||||
PYTHON_VERSION = 2
|
PYTHON_VERSION = 2
|
||||||
except AssertionError:
|
except NameError:
|
||||||
|
string_type = str
|
||||||
PYTHON_VERSION = 3
|
PYTHON_VERSION = 3
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user