Python pytest“;夹具';url';“未找到”;而没有使用固定装置
当我尝试执行测试(Python pytest“;夹具';url';“未找到”;而没有使用固定装置,python,automated-tests,pytest,allure,Python,Automated Tests,Pytest,Allure,当我尝试执行测试(python3-m pytest dir1/subdir/test.py)时,我得到错误: __________________________ ERROR at setup of testcase __________________________ file /usr/local/lib/python3.6/site-packages/allure_commons/_allure.py, line 50 def testcase(url, name=None): E
python3-m pytest dir1/subdir/test.py
)时,我得到错误:
__________________________ ERROR at setup of testcase __________________________
file /usr/local/lib/python3.6/site-packages/allure_commons/_allure.py, line 50
def testcase(url, name=None):
E fixture 'url' not found
> available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory, worker_id
> use 'pytest --fixtures [testpath]' for help on them.
/usr/local/lib/python3.6/site-packages/allure_commons/_allure.py:50
=========================== 1 error in 0.40 seconds ============================
但我在代码中没有使用任何“url”固定装置。
我甚至尝试重命名项目中的每个“url”变量,但问题仍然存在
安装要求:
allure-pytest==2.8.16
allure-python-commons==2.8.16
atomicwrites==1.4.0
attrs==19.3.0
axe-selenium-python==2.1.6
certifi==2020.4.5.2
chardet==3.0.4
colorama==0.4.3
configparser==5.0.0
coverage==5.1
crayons==0.3.1
cx-Oracle==7.3.0
Faker==4.1.0
flaky==3.6.1
idna==2.9
importlib-metadata==1.6.1
iso3166==1.0.1
more-itertools==8.3.0
packaging==20.4
page-objects==1.1.0
parameterized==0.7.4
pluggy==0.13.1
py==1.8.1
pycountry==19.8.18
pyparsing==2.4.7
pytest==5.4.3
python-dateutil==2.8.1
PyYAML==5.3.1
requests==2.23.0
schwifty==2020.5.3
selenium==3.141.0
simple-value-object==1.3
six==1.15.0
text-unidecode==1.3
urllib3==1.25.9
wcwidth==0.2.4
webdriver-manager==2.5.3
zipp==3.1.0
[更新]
我终于找到了解决办法。事实证明,我必须向我的测试类添加\uuuuu test\uuuu=True
仅供参考:我的所有测试都继承自TestBase(unittest.TestCase)
class
它具有属性\uuuu test\uuuu=False
。此属性的目的是不复制测试执行—一次从基类复制,另一次从继承的类复制。
更多详细信息:[更新]
我终于找到了解决办法。事实证明,我必须向我的测试类添加\uuuuu test\uuuu=True
仅供参考:我的所有测试都继承自TestBase(unittest.TestCase)
class
它具有属性\uuuu test\uuuu=False
。此属性的目的是不复制测试执行—一次从基类复制,另一次从继承的类复制。
更多详细信息:执行测试的当前目录是什么?是的,我的代码结构类似于:
base\u dir/src/project1/tests/my\u test.py
执行测试的当前目录是什么?是的,我的代码结构类似于:base\u dir/src/project1/tests/my\u test.py