logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

Python自动化测试之使用pytest-mock模拟用户输入

【代码】Python自动化测试之使用pytest-mock模拟用户输入。

文章图片
#python#pytest#开发语言
tortoise-orm在fastapi的lifespan中访问数据库表时报for r in self._routers:TypeError: ‘NoneType‘ object is not it

注:pip安装时如果报443连接超时,可以用ssh的方式(本地公钥需配置到github里):pip install --upgrade 'git+ssh://git@github.com/tortoise/tortoise-orm.git'解决:升级tortoise-orm使用github上的待发布版。如果还想消除warnning提示,可参照库文档的示例修改代码。升级完成后,不再报错了。

文章图片
#fastapi#python
No module named pip.main; ‘pip’ is a package and cannot be directly executed

pip --version时报了No module named pip.main的错误参考了这个:No module named pip.__main__; ‘pip‘ is a package and cannot be directly executed_天天放羊的博客-CSDN博客执行了:python -m ensurepip然后再重新python -m pip install -U pip

#pycharm#ide#python
fdfs_client.exceptions.ResponseError: Tracker response length is invaild, expect: 40, actual: 70

FastDFS的版本是最新的6.12(截至2024.05.15)升级成功后,重新执行代码,发现已经不再报错,能正常上传文件了。(需要Python3.10+)方案一:升级依赖包(

文章图片
#python#开发语言
tortoise-orm在fastapi的lifespan中访问数据库表时报for r in self._routers:TypeError: ‘NoneType‘ object is not it

注:pip安装时如果报443连接超时,可以用ssh的方式(本地公钥需配置到github里):pip install --upgrade 'git+ssh://git@github.com/tortoise/tortoise-orm.git'解决:升级tortoise-orm使用github上的待发布版。如果还想消除warnning提示,可参照库文档的示例修改代码。升级完成后,不再报错了。

文章图片
#fastapi#python
ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

解决ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

#linux#运维#服务器
poetry导出requirements.txt

命令如下:poetry export --with=dev --without-hashes -o dev_requirements.txt

文章图片
#linux#运维#服务器
pip换源、poetry换源、pdm换源、uv换源

pip、poetry换源--采用Python脚本实现,一行命令随意切换各种国内源

文章图片
#pip#python
uv换源:一行命令搞定

方法二:新建或修改全局配置文件(Linux和MacOS一般是~/.config/uv/uv.toml,Windows一般是%APPDATA%/uv/uv.toml,路径不存在的话直接手动创建即可)方法三:修改当前项目的pyproject.toml。如何给python的包管理工具uv换源?附:方法二脚本版,一行命令搞定。方法一:设置环境变量。

文章图片
#uv#linux#运维
linux 一行命令安装python3.7 & python3.8 & python3.9 & python3.10

最近(2019-03-28)在ubuntu18上是这样安装python3.6的,效果很不错,参考的是这个:install-python-3-6-ubuntu-linuxmintsudo apt-get install build-essential checkinstallsudo apt-get install libreadline-gplv2-dev libncursesw5-dev...

文章图片
    共 14 条
  • 1
  • 2
  • 请选择