问题遇到的现象和发生背景
Pycharm 运行pytest.main() 方法加入参数”-n=3“ 时运行提示下面的错误,无法解决,当前python版本是2.7,用过3.6,3.9都不行.在终端是可以运行成功的
用代码块功能插入代码,请勿粘贴截图
import os
import pytest
import requests
class Test_Yield_S:
a = 100
@pytest.fixture(scope='function')
def start(self):
print('11111111111111111')
yield Test_Yield_S.a
# return Test_Yield_S.a
def test_end(self, start):
rep = requests.get('https://www.baidu.com/')
print('https://www.baidu.com/'+rep.encoding+'')
# @pytest.mark.lixiangjiang
def test_bilibili(self):
rep = requests.get('https://www.bilibili.com/')
print('https://www.bilibili.com/'+rep.encoding+'')
# def setup(self):
# print('^^^^^^^^^^^^^^^^')
#
# def teardown(self):
# print('VVVVVVV123VVVV')
if __name__ == '__main__':
pytest.main(['-vs', '-n=3'])
运行结果及报错内容
C:\Users\Administrator\anaconda3\envs\python=2.7\python.exe C:\Users\Administrator\PycharmProjects\pythonProject3\test_yield_sample.py
usage: test_yield_sample.py [options] [file_or_dir] [file_or_dir] [...]
test_yield_sample.py: error: unrecognized arguments: -n=3
inifile: None
rootdir: C:\Users\Administrator\PycharmProjects\pythonProject3
我的解答思路和尝试过的方法
升级python或者降级python都不行
我想要达到的结果
--html=./**.html 也不可以使用