Skip to content

Fix collection error when tests is specified with --doctest-modules#3846

Merged
nicoddemus merged 1 commit into
pytest-dev:masterfrom
nicoddemus:issue-3843
Aug 22, 2018
Merged

Fix collection error when tests is specified with --doctest-modules#3846
nicoddemus merged 1 commit into
pytest-dev:masterfrom
nicoddemus:issue-3843

Conversation

@nicoddemus

Copy link
Copy Markdown
Member

The problem was that _matchnodes would receive two items: [DoctestModule, Module]. It would then collect the first one, cache it, and fail to match against the name in the command line. Next, it would reuse the cached item (DoctestModule) instead of collecting the Module which would eventually find the "test" name on it.

Added the type of the node to the cache key to avoid this problem, although I'm not a big fan of caches that have different key types.

Fix #3843

The problem was that _matchnodes would receive two items: [DoctestModule, Module]. It would then collect the first one, *cache it*, and fail to match against the name in the command line. Next, it would reuse the cached item (DoctestModule) instead of collecting the Module which would eventually find the "test" name on it.

Added the type of the node to the cache key to avoid this problem, although I'm not a big fan of caches that have different key types.

Fix pytest-dev#3843
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 92.634% when pulling 07a560f on nicoddemus:issue-3843 into f1079a8 on pytest-dev:master.

@nicoddemus nicoddemus merged commit 2137e2b into pytest-dev:master Aug 22, 2018
@nicoddemus nicoddemus deleted the issue-3843 branch August 22, 2018 11:17
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

Successfully merging this pull request may close these issues.

4 participants