Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pytest --doctest-modules crashes on file-level __test__ = False #113360

Open
Labels
stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
@kaddkaka

Description

@kaddkaka

Bug report

Bug description:

First opened this issue at pytest-dev but was directed here.pytest-dev/pytest#11730

A file level__test__ = False succesfully stopspytest from collecting any test from that file, however when runningpytest --doctest- modules on the same file, this error appears:

/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/runner.py:341: in from_call    result: Optional[TResult] = func()/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/runner.py:372: in <lambda>    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/doctest.py:587: in collect    for test in finder.find(module, module.__name__):/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/doctest.py:940: in find    self._find(tests, obj, name, module, source_lines, globs, {})/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/doctest.py:536: in _find    super()._find(  # type:ignore[misc]/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/doctest.py:1018: in _find    for valname, val in getattr(obj, '__test__', {}).items():E   AttributeError: 'bool' object has no attribute 'items'

It's enoough to have a file with only this content to see the behavior:

__test__=False

Version:

  • Python 3.10.5
  • pytest 7.4.3

CPython versions tested on:

3.10

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp