https://blog.csdn.net/qq_33801641/article/details/116220346
官方源码查看:https://www.cnblogs.com/canghai1024/p/13877314.html
return需要前置的函数(提前封装好)
# @pytest.fixture(scope="class", autouse=True) # def mobile_captcha_fixture(tmp_path_factory, worker_id): # if worker_id == "master": # return get_mobile_captcha() # # root_tmp_dir = tmp_path_factory.getbasetemp().parent # fn = root_tmp_dir / "data.json" # with FileLock(str(fn) + ".lock"): # if fn.is_file(): # data = json.loads(fn.read_text()) # else: # data = get_mobile_captcha() # fn.write_text(json.dumps(data)) # return data