Allow failure to cleanup
This commit is contained in:
parent
703104e412
commit
59f88030b7
|
@ -123,6 +123,13 @@ func (e *Environment) DeleteEnvironment() {
|
|||
assert.NoErrorf(e, err, "cleaning up test directory %q", e.RootPath)
|
||||
}
|
||||
|
||||
// DeleteEnvironment deletes the environment's RootPath, and everything
|
||||
// underneath it. It tolerates failing to delete the environment.
|
||||
func (e *Environment) DeleteEnviromentFallible() error {
|
||||
e.Helper()
|
||||
return os.RemoveAll(e.RootPath)
|
||||
}
|
||||
|
||||
// DeleteIfNotFailed deletes the environment's RootPath if the test hasn't failed. Otherwise
|
||||
// keeps the files around for aiding debugging.
|
||||
func (e *Environment) DeleteIfNotFailed() {
|
||||
|
|
|
@ -581,7 +581,7 @@ func TestAboutDotnet(t *testing.T) {
|
|||
e := ptesting.NewEnvironment(t)
|
||||
defer func() {
|
||||
if !t.Failed() {
|
||||
e.DeleteEnvironment()
|
||||
e.DeleteEnvironmentFallible()
|
||||
}
|
||||
}()
|
||||
e.ImportDirectory(dir)
|
||||
|
|
|
@ -748,7 +748,7 @@ func TestAboutGo(t *testing.T) {
|
|||
e := ptesting.NewEnvironment(t)
|
||||
defer func() {
|
||||
if !t.Failed() {
|
||||
e.DeleteEnvironment()
|
||||
e.DeleteEnvironmentFallible()
|
||||
}
|
||||
}()
|
||||
e.ImportDirectory(dir)
|
||||
|
|
|
@ -1132,7 +1132,7 @@ func TestAboutPython(t *testing.T) {
|
|||
e := ptesting.NewEnvironment(t)
|
||||
defer func() {
|
||||
if !t.Failed() {
|
||||
e.DeleteEnvironment()
|
||||
e.DeleteEnvironmentFallible()
|
||||
}
|
||||
}()
|
||||
e.ImportDirectory(dir)
|
||||
|
|
Loading…
Reference in a new issue