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

Fix collection error for .txt files #704

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

seifertm
Copy link
Contributor

@seifertm seifertm commented Dec 4, 2023

Fixes a bug that caused an internal pytest error when collecting .txt files.

When pytest encounters a .txt file, it is collected as a DoctestTextFile. Although DoctestTextFile is considered a subtype of Module, its obj property is always None and causes an INTERNALERROR.

https://github.com/pytest-dev/pytest/blob/714ce2e872f0e1dc3b0363949d084e3e64f88c82/src/_pytest/doctest.py#L422-L423

Resolves #703

…g .txt files.

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a214c3e) 94.86% compared to head (c2c0e66) 94.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #704      +/-   ##
==========================================
+ Coverage   94.86%   94.89%   +0.03%     
==========================================
  Files           2        2              
  Lines         467      470       +3     
  Branches       92       93       +1     
==========================================
+ Hits          443      446       +3     
  Misses         16       16              
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seifertm seifertm added this pull request to the merge queue Dec 4, 2023
Merged via the queue into pytest-dev:main with commit b614c77 Dec 4, 2023
9 checks passed
@seifertm seifertm deleted the collection-error-for-textfiles branch December 4, 2023 07: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.

INTERNALLERROR when collecting .txt files in v0.23.1
2 participants