patch_redis() fails in pytest if --doctest-modules
Opened this issue · 0 comments
fernandocamargoai commented
I've been using redislite to write unit tests for a project. I recently move this project to a repo following this template, which configures pytest using pyproject.toml
. When I tried running my tests again, they failed and after some investigation, I discovered that it was the --doctest-modules
. Here is my config:
[tool.pytest.ini_options]
# https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml
# Directories that are not visited by pytest collector:
norecursedirs =["hooks", "*.egg", ".eggs", "dist", "build", "docs", ".tox", ".git", "__pycache__"]
doctest_optionflags = ["NUMBER", "NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL"]
# Extra options:
addopts = [
"--strict-markers",
"--tb=short",
# "--doctest-modules", # For some reason, makes the patch_redis() fail
"--doctest-continue-on-failure",
]
If I uncomment the --doctest-modules
, it seems that patch_redis()
has no effect (it's at the top of the .py, btw).