【发布时间】:2020-06-08 19:20:19
【问题描述】:
当我尝试执行测试 (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
【问题讨论】:
-
您执行测试的当前目录是什么?是
/吗? -
是的,我的代码结构类似于:
base_dir/src/project1/tests/my_test.py
标签: python automated-tests pytest allure