logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

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

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

文章图片
#python#pytest#开发语言
{'detail': 'Authentication credentials were not provided.'} django rest framework

昨天手动测试 djangorestframework时,遇到 403 {'detail': 'Authentication credentials were not provided.'} 的问题,今天自动测试又遇到了,所以记录一下:一、手动提交时,我是这样解决问题的:http -a wenjie:jaket521 POST http://127.0.0.1:8000/snippets/

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
python os.popen 提示 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte illegal multibyte sequence

原有代码如下:def run_silently(cmd: str) -> str:"""返回系统命令的执行结果"""with os.popen(cmd) as fp:return fp.read().strip()在ubuntu里执行,一点问题也没有,去到Windows就报错了经试验:`print(run_silently('echo 拟好'))` 能正常运行, `print(run_sil

文章图片
#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#开发语言
nginx配置favicon.ico

配置完,在chrome浏览器刷新页面、修改URL地址、打开新标签、新的无痕窗口,全都不起作用。改成用firefox打开,发现其实已经起作用了,左上角的图标已经变成想要的样子。

文章图片
#nginx#服务器#linux
github双因子认证

最近换了个安卓手机,打算让之前的苹果手机退役了,所以需要重新搞GitHub的Two-factor authentication。然后把手机APP里显示的六位数字,输入到xxxxxx的位置,在点击save按钮,就可以了。2. 点击Authenticator app右侧按钮。3. 下载腾讯身份验证器,点击二维码激活。4. 扫描网页上的二维码。

文章图片
#github
dpkg: error processing package redis-server (--configure): installed redis-server package post-inst

阿里云 Ubuntu18 安装Redis报错如下:dpkg: error processing package redis-server (--configure): installed redis-server package post-installation script subprocess returned error exit status 1 Errors were encou...

    共 30 条
  • 1
  • 2
  • 3
  • 请选择