Title: pytest --doctest-modules crashes on file-level __test__ = False · Issue #113360 · python/cpython · GitHub
Open Graph Title: pytest --doctest-modules crashes on file-level __test__ = False · Issue #113360 · python/cpython
X Title: pytest --doctest-modules crashes on file-level __test__ = False · Issue #113360 · python/cpython
Description: 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 stops pytest from collecting any test from that file, however when running pytest ...
Open Graph Description: 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 stops pytest from collecting any test from...
X Description: 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 stops pytest from collecting any test from...
Opengraph URL: https://github.com/python/cpython/issues/113360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pytest --doctest-modules crashes on file-level __test__ = False","articleBody":"# Bug report\n\n### Bug description:\n\nFirst opened this issue at pytest-dev but was directed here. https://github.com/pytest-dev/pytest/issues/11730\n\nA file level `__test__ = False` succesfully stops `pytest` from collecting any test from that file, however when running `pytest --doctest- modules` on the same file, this error appears:\n\n```\n/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/runner.py:341: in from_call\n result: Optional[TResult] = func()\n/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/runner.py:372: in \u003clambda\u003e\n call = CallInfo.from_call(lambda: list(collector.collect()), \"collect\")\n/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/doctest.py:587: in collect\n for test in finder.find(module, module.__name__):\n/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/doctest.py:940: in find\n self._find(tests, obj, name, module, source_lines, globs, {})\n/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/site-packages/_pytest/doctest.py:536: in _find\n super()._find( # type:ignore[misc]\n/sw/Python/Ubuntu-22.04/3.10.5/lib/python3.10/doctest.py:1018: in _find\n for valname, val in getattr(obj, '__test__', {}).items():\nE AttributeError: 'bool' object has no attribute 'items'\n```\n\nIt's enoough to have a file with only this content to see the behavior:\n```py\n__test__ = False\n```\n\nVersion:\n- `Python 3.10.5`\n- `pytest 7.4.3`\n\n### CPython versions tested on:\n\n3.10\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-113389\n* gh-113393\n* gh-113760\n* gh-113761\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/kaddkaka","@type":"Person","name":"kaddkaka"},"datePublished":"2023-12-21T15:09:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/113360/cpython/issues/113360"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:41f1fbff-d90c-5434-6671-4f7535bf72d6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D818:11169F:C281C6:102598E:696AC2A6 |
| html-safe-nonce | a3e30fd39b7b970c2dfa7634a64ff462b637c462812be2940783418b8a052237 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODE4OjExMTY5RjpDMjgxQzY6MTAyNTk4RTo2OTZBQzJBNiIsInZpc2l0b3JfaWQiOiI4Njc3NjczNDc0MTgxNDgxMTI2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e48cc6275f2df7a985495db6ca57956d1958817f932d9de7d4aaaf6f52c40f3d |
| hovercard-subject-tag | issue:2052600835 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/113360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/98eb2c4288a9156203d3e207d3a31229433d150b97c4be19769b4bf88e2515e2/python/cpython/issues/113360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/98eb2c4288a9156203d3e207d3a31229433d150b97c4be19769b4bf88e2515e2/python/cpython/issues/113360 |
| og:image:alt | 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 stops pytest from collecting any test from... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kaddkaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 986b6a1d774985095564e64d6963d11f094da3d0e2bfda2ab1a27d63662eb033 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 89ad2112b9c4e11df6a0c13c8c1f8eedd36b0977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width