Skip to content

Commit

Permalink
Fix TypeError in report_collect with _collect_report_last_write
Browse files Browse the repository at this point in the history
`_collect_report_last_write` might be None, when `pytest_collection` was
not called before.  Not sure if this indicates another problem, but it
can be reproduced with `testing/test_collection.py::TestCollector::()::test_getcustomfile_roundtrip`.

Fixes pytest-dev#4329
  • Loading branch information
blueyed committed Nov 7, 2018
1 parent 64762d2 commit 91404db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/4329.bugfix.rst
@@ -0,0 +1 @@
Fix TypeError in report_collect with _collect_report_last_write.
5 changes: 4 additions & 1 deletion src/_pytest/terminal.py
Expand Up @@ -497,7 +497,10 @@ def report_collect(self, final=False):
if not final:
# Only write "collecting" report every 0.5s.
t = time.time()
if self._collect_report_last_write > t - 0.5:
if (
self._collect_report_last_write is not None
and self._collect_report_last_write > t - 0.5
):
return
self._collect_report_last_write = t

Expand Down

0 comments on commit 91404db

Please sign in to comment.