refactor: reformat all code with black

This commit is contained in:
debugtalk
2022-04-23 15:05:21 +08:00
parent 7eaa8a4ac0
commit 418a16fcee
27 changed files with 169 additions and 213 deletions

View File

@@ -59,7 +59,7 @@ def teardown_hook_example(name):
return f"teardown_hook_example: {name}"
if __name__ == '__main__':
if __name__ == "__main__":
funppy.register("get_httprunner_version", get_httprunner_version)
funppy.register("sum", sum)
funppy.register("sum_ints", sum_ints)

View File

@@ -36,8 +36,8 @@ def sum_two(m, n):
def sum_status_code(status_code, expect_sum):
""" sum status code digits
e.g. 400 => 4, 201 => 3
"""sum status code digits
e.g. 400 => 4, 201 => 3
"""
sum_value = 0
for digit in str(status_code):
@@ -54,8 +54,7 @@ os.environ["TEST_ENV"] = "PRODUCTION"
def skip_test_in_production_env():
""" skip this test in production environment
"""
"""skip this test in production environment"""
return os.environ["TEST_ENV"] == "PRODUCTION"
@@ -97,8 +96,7 @@ def setup_hook_remove_kwargs(request):
def teardown_hook_sleep_N_secs(response, n_secs):
""" sleep n seconds after request
"""
"""sleep n seconds after request"""
if response.status_code == 200:
time.sleep(0.1)
else:

View File

@@ -54,8 +54,7 @@ def session_fixture(request):
summary["details"].append(testcase_summary_json)
summary_path = os.path.join(
os.getcwd(),
"examples/postman_echo/logs/request_methods/hardcode.summary.json"
os.getcwd(), "examples/postman_echo/logs/request_methods/hardcode.summary.json"
)
summary_dir = os.path.dirname(summary_path)
os.makedirs(summary_dir, exist_ok=True)

View File

@@ -1,22 +0,0 @@
config:
name: "demo testsuite"
variables: ${get_testsuite_config_variables()}
testcases:
-
name: request with functions
testcase: request_methods/request_with_functions.yml
weight: 2
variables:
foo1: testcase_ref_bar11
expect_foo1: testcase_ref_bar11
expect_foo2: testsuite_config_bar2
-
name: request with referenced testcase
testcase: request_methods/request_with_testcase_reference.yml
weight: 3
variables:
foo1: testcase_ref_bar12
expect_foo1: testcase_ref_bar12
foo2: testcase_ref_bar22
expect_foo2: testcase_ref_bar22