mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 06:23:52 +08:00
bugfix: UnicodeEncodeError when value is in Chinese
This commit is contained in:
@@ -365,10 +365,11 @@ def print_output(output):
|
|||||||
return
|
return
|
||||||
|
|
||||||
print("\n================== Output ==================")
|
print("\n================== Output ==================")
|
||||||
print('{:<10}: {:<}'.format("Variable", "Value"))
|
print('{:<16}: {:<}'.format("Variable", "Value"))
|
||||||
print('{:<10}: {:<}'.format("--------", "-----"))
|
print('{:<16}: {:<}'.format("--------", "-----"))
|
||||||
|
|
||||||
for variable, value in output.items():
|
for variable, value in output.items():
|
||||||
print('{:<10}: {:<}'.format(variable, value))
|
print('{:<16}: {:<}'.format(
|
||||||
|
variable.encode("utf-8"), value.encode("utf-8")))
|
||||||
|
|
||||||
print("============================================\n")
|
print("============================================\n")
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class TestTask(ApiServerUnittest):
|
|||||||
|
|
||||||
def test_create_task(self):
|
def test_create_task(self):
|
||||||
testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo_testset_variables.yml')
|
testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo_testset_variables.yml')
|
||||||
task_suite = task.create_task(testcase_file_path)
|
task_suite = task.TaskSuite(testcase_file_path)
|
||||||
self.assertEqual(task_suite.countTestCases(), 3)
|
self.assertEqual(task_suite.countTestCases(), 3)
|
||||||
for suite in task_suite:
|
for suite in task_suite:
|
||||||
for testcase in suite:
|
for testcase in suite:
|
||||||
|
|||||||
Reference in New Issue
Block a user