mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 17:29:56 +08:00
fix: IndexError in ensure_file_path_valid when file_path=os.getcwd()
This commit is contained in:
@@ -199,6 +199,9 @@ def ensure_file_path_valid(file_path: Text) -> Text:
|
||||
else:
|
||||
raw_file_relative_name = raw_file_name
|
||||
|
||||
if raw_file_relative_name == "":
|
||||
return file_path
|
||||
|
||||
path_names = []
|
||||
for name in raw_file_relative_name.rstrip(os.sep).split(os.sep):
|
||||
|
||||
|
||||
@@ -122,6 +122,16 @@ class TestUtils(unittest.TestCase):
|
||||
ensure_file_path_valid("examples/postman_echo/request_methods/"),
|
||||
os.path.join(os.getcwd(), "examples/postman_echo/request_methods"),
|
||||
)
|
||||
self.assertEqual(
|
||||
ensure_file_path_valid(os.path.join(os.getcwd(), "test.yml")),
|
||||
os.path.join(os.getcwd(), "test.yml"),
|
||||
)
|
||||
self.assertEqual(
|
||||
ensure_file_path_valid(os.getcwd()), os.getcwd(),
|
||||
)
|
||||
self.assertEqual(
|
||||
ensure_file_path_valid(os.getcwd() + ".csv"), os.getcwd() + ".csv",
|
||||
)
|
||||
|
||||
def test_safe_dump_json(self):
|
||||
class A(object):
|
||||
|
||||
Reference in New Issue
Block a user