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

Log test durations #5896

Open
dsotirho-ucsc opened this issue Jan 25, 2024 · 6 comments
Open

Log test durations #5896

dsotirho-ucsc opened this issue Jan 25, 2024 · 6 comments
Assignees
Labels
+ [priority] High debt [type] A defect incurring continued engineering cost demo [process] To be demonstrated at the end of the sprint enh [type] New feature or request groomed [process] Issue was recently looked at during backlog grooming orange [process] Done by the Azul team spike:1 [process] Spike estimate of one point test [subject] Unit and integration test code

Comments

@dsotirho-ucsc
Copy link
Contributor

dsotirho-ucsc commented Jan 25, 2024

@hannes-ucsc: "Python 3.12 adds the ability to track test durations. "

@dsotirho-ucsc dsotirho-ucsc added orange [process] Done by the Azul team enh [type] New feature or request debt [type] A defect incurring continued engineering cost test [subject] Unit and integration test code + [priority] High labels Jan 25, 2024
@dsotirho-ucsc dsotirho-ucsc self-assigned this Jan 26, 2024
@achave11-ucsc
Copy link
Member

This is parked because blocker is parked.

@dsotirho-ucsc
Copy link
Contributor Author

Moving to Triage since blocker #5736 has been merged.

@dsotirho-ucsc dsotirho-ucsc added - [priority] Medium spike:1 [process] Spike estimate of one point and removed + [priority] High labels Dec 9, 2024
@dsotirho-ucsc
Copy link
Contributor Author

Spike for design, how can we override that method (addDuration)

@dsotirho-ucsc dsotirho-ucsc added the needs design [process] Solution to issue has yet to be devised label Dec 9, 2024
@hannes-ucsc hannes-ucsc added + [priority] High and removed - [priority] Medium labels Dec 21, 2024
@hannes-ucsc
Copy link
Member

I'll take this.

@hannes-ucsc
Copy link
Member

Option 1)

Override defaultTestResult in AzulTestCase to return a subclass of TextTestResult which overrides addDuration to log the duration.

Option 2)

make test

is equivalent to

coverage run -m unittest discover test --verbose.

coverage run is a wrapper for python and so that is equivalent to

coverage run -c "from unittest.main import main; main(module=None, argv=['foo', 'discover','test','--verbose'])"

We can now pass the testRunner= keyword argument to main(). It defaults to None which causes an instance of runner.TextTestRunner to be used. Subclass runner.TextTestRunner and pass that to main via testRunner=. Override _makeResult in the runner subclass to return the result subclass from option 1.

Update the Makefile to use the coverage run -c … with the above equivalence instead. Instead of passing a Python code fragment via -c, create a script and pass the path of that script to coverage run.

@hannes-ucsc hannes-ucsc removed the needs design [process] Solution to issue has yet to be devised label Dec 31, 2024
@hannes-ucsc hannes-ucsc removed their assignment Dec 31, 2024
@hannes-ucsc hannes-ucsc added the groomed [process] Issue was recently looked at during backlog grooming label Dec 31, 2024
dsotirho-ucsc added a commit that referenced this issue Jan 17, 2025
dsotirho-ucsc added a commit that referenced this issue Jan 23, 2025
dsotirho-ucsc added a commit that referenced this issue Jan 27, 2025
@hannes-ucsc
Copy link
Member

For demo show logged test durations in GH workflows and GL pipelines for develop.

@hannes-ucsc hannes-ucsc added the demo [process] To be demonstrated at the end of the sprint label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
+ [priority] High debt [type] A defect incurring continued engineering cost demo [process] To be demonstrated at the end of the sprint enh [type] New feature or request groomed [process] Issue was recently looked at during backlog grooming orange [process] Done by the Azul team spike:1 [process] Spike estimate of one point test [subject] Unit and integration test code
Projects
None yet
Development

No branches or pull requests

3 participants