bar*_*red 1 python-3.x python-poetry
我想尝试诗歌,但最初的设置/测试对我不起作用,所以我有点困惑。我相信它应该“正常工作”,所以我想我错过了一些简单的步骤?
\n我使用的是 macOS:12.3 (21E230)\n我安装了最新版本:
\n$ poetry --version\nPoetry version 1.1.13\nRun Code Online (Sandbox Code Playgroud)\n现在我只想要一个纯粹的香草设置,并验证基础知识是否有效:
\n$ poetry new poetry_demo --src\nCreated package poetry_demo in poetry_demo\n$ cd poetry_demo/\n$ poetry install\nCreating virtualenv poetry-demo in /Users/barryredmond/dev/git/poetry_demo/.venv\nUpdating dependencies\nResolving dependencies... (0.1s)\n\nWriting lock file\n\nPackage operations: 8 installs, 0 updates, 0 removals\n\n \xe2\x80\xa2 Installing pyparsing (3.0.8)\n \xe2\x80\xa2 Installing attrs (21.4.0)\n \xe2\x80\xa2 Installing more-itertools (8.13.0)\n \xe2\x80\xa2 Installing packaging (21.3)\n \xe2\x80\xa2 Installing pluggy (0.13.1)\n \xe2\x80\xa2 Installing py (1.11.0)\n \xe2\x80\xa2 Installing wcwidth (0.2.5)\n \xe2\x80\xa2 Installing pytest (5.4.3)\n\nInstalling the current project: poetry_demo (0.1.0)\n\n$ poetry check\nAll set!\nRun Code Online (Sandbox Code Playgroud)\n我认为这应该让我做好准备?让我们运行内置测试:
\n$ poetry run pytest\n================================================================================================ test session starts =================================================================================================\nplatform darwin -- Python 3.10.4, pytest-5.4.3, py-1.11.0, pluggy-0.13.1\nrootdir: /Users/barryredmond/dev/git/poetry_demo\ncollected 0 items / 1 error\n\n======================================================================================================= ERRORS =======================================================================================================\n_____________________________________________________________________________________ ERROR collecting tests/test_poetry_demo.py _____________________________________________________________________________________\n.venv/lib/python3.10/site-packages/py/_path/local.py:704: in pyimport\n __import__(modname)\n<frozen importlib._bootstrap>:1027: in _find_and_load\n ???\n<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked\n ???\n<frozen importlib._bootstrap>:688: in _load_unlocked\n ???\n.venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:143: in exec_module\n source_stat, co = _rewrite_test(fn, self.config)\n.venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:330: in _rewrite_test\n co = compile(tree, fn, "exec", dont_inherit=True)\nE TypeError: required field "lineno" missing from alias\n============================================================================================== short test summary info ===============================================================================================\nERROR tests/test_poetry_demo.py - TypeError: required field "lineno" missing from alias\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n================================================================================================== 1 error in 0.05s ==================================================================================================\nRun Code Online (Sandbox Code Playgroud)\n只是为了验证该设置对于任何查看此内容的人来说是否正确:
\n$ tree\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 README.rst\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 poetry.lock\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pyproject.toml\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 poetry_demo\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 tests\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __pycache__\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 __init__.cpython-310.pyc\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 test_poetry_demo.py\n\n4 directories, 7 files\nRun Code Online (Sandbox Code Playgroud)\n。
\n$ cat tests/test_poetry_demo.py\nfrom poetry_demo import __version__\n\n\ndef test_version():\n assert __version__ == '0.1.0'\nRun Code Online (Sandbox Code Playgroud)\n。
\n$ cat src/poetry_demo/__init__.py\n__version__ = '0.1.0'\nRun Code Online (Sandbox Code Playgroud)\n我也尝试过没有--src但它是一样的。
目前使用的pytest版本已经过时,无法与 python3.10 一起使用。您必须使用进行更新。poetrypoetry newpytestpoetry add --dev pytest@latest
从诗歌 1.2 开始,诗歌在通过 初始化项目时将不再定义任何默认依赖项poetry new。
| 归档时间: |
|
| 查看次数: |
3624 次 |
| 最近记录: |