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

testing: document that TestMain always runs before any benchmarks #45764

Closed
ghost opened this issue Apr 26, 2021 · 2 comments
Closed

testing: document that TestMain always runs before any benchmarks #45764

ghost opened this issue Apr 26, 2021 · 2 comments
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ghost
Copy link

ghost commented Apr 26, 2021

The docs for TestMain say:

It is sometimes necessary for a test program to do extra setup
or teardown before or after testing.

https://golang.org/pkg/testing/#hdr-Main

But what if one needs to do extra setup before benchmarking? It appears that TestMain would also always run before benchmarks, but neither TestMain doc nor M.Run doc say anything about benchmarks.

@cherrymui cherrymui changed the title doc: document that TestMain always runs before any benchmarks testing: document that TestMain always runs before any benchmarks Apr 26, 2021
@cherrymui cherrymui added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 26, 2021
@cherrymui cherrymui added this to the Backlog milestone Apr 26, 2021
@cherrymui
Copy link
Member

cc @mpvl @bcmills

@gopherbot
Copy link

Change https://golang.org/cl/314349 mentions this issue: testing: document that TestMain can be used with benchmarks

@golang golang locked and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants