From 31fb29fb3f306678f3697e05bbccefb2078d7f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 16 Jun 2021 18:58:40 +0200 Subject: Do not read config from os.Environ when running tests Fixes #8655 --- common/hugo/hugo.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common') diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index 13ed47736..bf3dee26e 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -141,3 +141,13 @@ func GetDependencyList() []string { return deps } + +// IsRunningAsTest reports whether we are running as a test. +func IsRunningAsTest() bool { + for _, arg := range os.Args { + if strings.HasPrefix(arg, "-test") { + return true + } + } + return false +} -- cgit v1.2.3