Skip to content

Generate junit report when pytest-timeout kills pytest - #5832

Merged
crusaderky merged 4 commits into
dask:mainfrom
crusaderky:pytest-timeout
Feb 21, 2022
Merged

crusaderky merged 4 commits into
dask:mainfrom
crusaderky:pytest-timeout

Conversation

@crusaderky

@crusaderky crusaderky commented Feb 17, 2022 •

Copy link
Copy Markdown
Collaborator

Closes #5798

Enabled and tested 'signal' method of pytest-timeout on MacOSX in addition to Linux. This means that when pytest-timeout kicks in it selectively kills the stuck test.

On Windows, the 'signal' method is not available and pytest-timeout kills the whole process. When it does, pytest won't generate a junit report. When this happens, parse the pytest stdout and generate one. Obviously, any tests that were supposed to run after the hung test will be missing.

Demo: https://github.com/dask/distributed/runs/5264200578

@github-actions

github-actions Bot commented Feb 17, 2022 •

Copy link
Copy Markdown
Contributor

Unit Test Results

       12 files  ±  0         12 suites  ±0   7h 13m 24s ⏱️ + 14m 11s
  2 609 tests +  2    2 529 ✔️ +  2       79 💤 ±  0  1 ❌ +1 
15 578 runs  +12  14 489 ✔️  - 66  1 088 💤 +79  1 ❌ ±0 

For more details on these failures, see this check.

Results for commit 5c694f3. ± Comparison against base commit d2d76c0.

♻️ This comment has been updated with latest results.

@crusaderky crusaderky self-assigned this Feb 20, 2022
@crusaderky
crusaderky marked this pull request as ready for review February 20, 2022 12:17
@crusaderky crusaderky closed this Feb 20, 2022
@crusaderky crusaderky reopened this Feb 20, 2022

@fjetter fjetter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to use print but this is not a strong opinion since this is only a small script.

I am wondering how stable the xml output and stdout of pytest is but I assume it is sufficient for our purposes?

timestamp = datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")

# We could have used ElementTree but it feels like overkill here
print('<?xml version="1.0" encoding="utf-8"?>')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printing is an interesting choice.
I assume this was done for debugging? Why not write to a file or file-like object? This way we could write the proper file out directly and/or put sys.stdout in for debugging

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason for the choice; the support in pytest for capturing stdout is good and clean so it doesn't really make a difference.

I am wondering how stable the xml output and stdout of pytest is but I assume it is sufficient for our purposes?

Perfectly stable.

@crusaderky
crusaderky merged commit 7f1691e into dask:main Feb 21, 2022
@crusaderky
crusaderky deleted the pytest-timeout branch February 21, 2022 18:48
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.

Test trend report should cover timed out test suites

2 participants