Laboratory 是一个 Python 库用来处理重构关键路径。
想象一下你正在实现复杂的缓存策略,那么你如何进行测试已经确保在一定压力下已经生产环境中的数据是准确无误的呢?
而 Laboratory 可以:
同时运行新的和老的代码
对比不同代码的结果
记录所有代码的执行时间
记录新代码的异常
发布上述信息
示例代码:
import laboratory experiment = laboratory.Experiment() with experiment.control() as c: c.record(get_objects_from_database()) with experiment.candidate() as c: c.record(get_objects_from_cache()) objects = experiment.run()
python非官方安装包 https://www.lfd.uci.edu/~gohlke/pythonlibs/ Unofficial Windows Binaries for Python Extension Packages by Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California,
import pymysql import threading import datetime import random import requests import json import re import time class DB(object): """创建MySQL实例""" def __init__(self, host=None, username=None, pwd=None,
参考简单粗暴有效上手Python3异步asyncio_Dexter's Laboratory-CSDN博客_python3 异步 实验代码: import asyncio import subprocess async def first(): print('first函数调用开始,下面将会等待3秒模拟函数运行完毕') await asyncio.sleep(3) pri