Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch_redis() fails in pytest if --doctest-modules #154

Open
fernandocamargoai opened this issue Oct 18, 2021 · 0 comments
Open

patch_redis() fails in pytest if --doctest-modules #154

fernandocamargoai opened this issue Oct 18, 2021 · 0 comments

Comments

@fernandocamargoai
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant