aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorNobuki Fujii <scofni@gmail.com>2022-09-23 22:53:31 +0900
committerGopher Robot <gobot@golang.org>2022-09-29 22:16:42 +0000
commita14ac8635f673218c91e13c103cb2f3e29ff4b74 (patch)
tree64a350420b0f898495665e63f9a75eda952557c5 /src/testing
parente7a3d87ddae6aa720e104213bd2cf98e3e743c9a (diff)
downloadgo-a14ac8635f673218c91e13c103cb2f3e29ff4b74.tar.xz
testing: update description of Setenv
Add the description of Setenv that it cannot use if the test have parallel ancestors. Fixes #55128 Change-Id: Ia5a1deaa1a3116d1ebb439600a7d316c7d155412 Reviewed-on: https://go-review.googlesource.com/c/go/+/434115 Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index b64286c005..c7d51a13e3 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -1187,7 +1187,8 @@ func removeAll(path string) error {
// restore the environment variable to its original value
// after the test.
//
-// This cannot be used in parallel tests.
+// Because Setenv affects the whole process, it cannot be used
+// in parallel tests or tests with parallel ancestors.
func (c *common) Setenv(key, value string) {
c.checkFuzzFn("Setenv")
prevValue, ok := os.LookupEnv(key)
@@ -1324,7 +1325,8 @@ func (t *T) Parallel() {
// restore the environment variable to its original value
// after the test.
//
-// This cannot be used in parallel tests.
+// Because Setenv affects the whole process, it cannot be used
+// in parallel tests or tests with parallel ancestors.
func (t *T) Setenv(key, value string) {
// Non-parallel subtests that have parallel ancestors may still
// run in parallel with other tests: they are only non-parallel