[Pytest-commit] [pytest-dev/pytest] 07a560: Fix collection error when tests is specified with ...

Bruno Oliveira nicoddemus at gmail.com
Wed Aug 22 07:17:10 EDT 2018


  Branch: refs/heads/master
  Home:   https://github.com/pytest-dev/pytest
  Commit: 07a560ff246a28e4ab8567404d7f55afb40a3c36
      https://github.com/pytest-dev/pytest/commit/07a560ff246a28e4ab8567404d7f55afb40a3c36
  Author: Bruno Oliveira <nicoddemus at gmail.com>
  Date:   2018-08-21 (Tue, 21 Aug 2018)

  Changed paths:
    A changelog/3843.bugfix.rst
    M src/_pytest/main.py
    M testing/acceptance_test.py

  Log Message:
  -----------
  Fix collection error when tests is specified with --doctest-modules

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


  Commit: 2137e2b15b3261d2ee1af7d7ed2a5b0ae4dbfa4c
      https://github.com/pytest-dev/pytest/commit/2137e2b15b3261d2ee1af7d7ed2a5b0ae4dbfa4c
  Author: Bruno Oliveira <nicoddemus at gmail.com>
  Date:   2018-08-22 (Wed, 22 Aug 2018)

  Changed paths:
    A changelog/3843.bugfix.rst
    M src/_pytest/main.py
    M testing/acceptance_test.py

  Log Message:
  -----------
  Merge pull request #3846 from nicoddemus/issue-3843

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


Compare: https://github.com/pytest-dev/pytest/compare/3b521bedf8a5...2137e2b15b32
      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the pytest-commit mailing list