Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

装完依赖后,运行pytest报错 #91

Open
haolixu opened this issue Mar 8, 2023 · 4 comments
Open

装完依赖后,运行pytest报错 #91

haolixu opened this issue Mar 8, 2023 · 4 comments

Comments

@haolixu
Copy link

haolixu commented Mar 8, 2023

image

@3293406747
Copy link
Owner

3293406747 commented Mar 8, 2023

这个问题是由于pytest自身的原因导致的

解决办法:

  1. 找到iniconfig模块下的__init__文件,我是通过pycharm中双击shift键输入iniconfig/__init__找到此文件的。
  2. 在此文件的第52行添加encoding=“gbk”。

问题产生原因:

python中的open方法在Window系统中使用时默认编码方式为gbk编码,读取gbk及utf-8编码的文件时均不会报错;在linux系统中使用时默认编码方式为utf-8编码这时读取gbk编码格式的文件时就会报错。

@haolixu
Copy link
Author

haolixu commented Mar 14, 2023

我找到__init__文件了,不过是改的112行。。。

@haolixu
Copy link
Author

haolixu commented Mar 14, 2023

然后运行pytest报新的错误了!
image

@3293406747
Copy link
Owner

问题已修复,可以重现pull一下。是由于在linux中分隔符只能使用/导致的,我已将yaml示例文件中的路径分隔符改为/,兼容了windows和linux系统。感谢您提出的issue。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants