Skip to content

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

Closed

Description

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.

Activity

  1. changed the title [-]doc: document that TestMain always runs before any benchmarks[/-] [+]testing: document that TestMain always runs before any benchmarks[/+] on Apr 26, 2021
  2. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Apr 26, 2021
  3. added this to the Backlog milestone on Apr 26, 2021
  4. cherrymui commented on Apr 26, 2021

    @cherrymui
    Member
  5. added 3 commits that reference this issue on Apr 27, 2021
    04b1551
    0941a0c
    8b6f838
  6. gopherbot commented on Apr 27, 2021

    @gopherbot
    Contributor

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

  7. locked and limited conversation to collaborators on Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions