mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: CSV relative path detection
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
__title__ = 'HttpRunner'
|
||||
__description__ = 'One-stop solution for HTTP(S) testing.'
|
||||
__url__ = 'https://github.com/HttpRunner/HttpRunner'
|
||||
__version__ = '2.0.5'
|
||||
__version__ = '2.0.6'
|
||||
__author__ = 'debugtalk'
|
||||
__author_email__ = 'mail@debugtalk.com'
|
||||
__license__ = 'Apache-2.0'
|
||||
|
||||
@@ -50,6 +50,9 @@ class VariableNotFound(NotFoundError):
|
||||
class EnvNotFound(NotFoundError):
|
||||
pass
|
||||
|
||||
class CSVNotFound(NotFoundError):
|
||||
pass
|
||||
|
||||
class ApiNotFound(NotFoundError):
|
||||
pass
|
||||
|
||||
|
||||
@@ -80,6 +80,15 @@ def load_csv_file(csv_file):
|
||||
]
|
||||
|
||||
"""
|
||||
if not os.path.isabs(csv_file):
|
||||
project_working_directory = tests_def_mapping["PWD"] or os.getcwd()
|
||||
# make compatible with Windows/Linux
|
||||
csv_file = os.path.join(project_working_directory, *csv_file.split("/"))
|
||||
|
||||
if not os.path.isfile(csv_file):
|
||||
# file path not exist
|
||||
raise exceptions.CSVNotFound(csv_file)
|
||||
|
||||
csv_content_list = []
|
||||
|
||||
with io.open(csv_file, encoding='utf-8') as csvfile:
|
||||
|
||||
Reference in New Issue
Block a user