PyCharm, Poetry, pytest

Apparently pytest will take its option-settings from Poetry's pyproject.toml file.
(https://docs.pytest.org/en/7.1.x/reference/customize.html#pyproject-toml)

Have created new project with Poetry interpreter, script, and test-script. Script works fine. Test-script works correctly.

Wanted to add an option to pytest. Rather than add to the run-config of every test-script in the project, or to the pytest.ini (affecting every project), thought to use the project's .toml.

Using current/proven (test) Run configuration, PyCharm does not seem to recognise .toml settings. (PyCharm 2023.1 (CE), pytest 7.3.1)

Here is relevant section of .toml (yes, after changing pyproject.toml ran poetry update):

[tool.pytest.ini_options]
minversion = "6.0"
addopts = [
"-ra ",
#"-l",
"--show-capture=all",
]
#-P
# -p
#-q # quiet, opposite of v=verbose"
testpaths = [
"tests",
"integration",
]

Interestingly, if use terminal (or PyCharm Terminal ToolWindow) to run pytest, the options in .toml are picked-up and applied.

help/pycharm pages don't seem to cover the Poetry and pytest combination.

Is it possible?

Please advise =dn

6
1 comment

@...  any updates here? it's really annoying to not be able to run the tests 

1

Please sign in to leave a comment.