Skip to content

Commit

Permalink
fix case of html report not generating in pytest with failing tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
neel-astro authored and kushalmalani committed Sep 12, 2023
1 parent fb3d586 commit 9a02d31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion airflow/docker_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (d *DockerImage) Pytest(pytestFile, airflowHome, envFile, testHomeDirectory
// start pytest container
docErr = cmdExec(dockerCommand, stdout, stderr, []string{"start", "astro-pytest", "-a"}...)
if docErr != nil {
return "", docErr
log.Debugf("Error starting pytest container: %s", docErr.Error())
}
// get exit code
args = []string{
Expand Down
6 changes: 5 additions & 1 deletion airflow/docker_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,16 @@ func TestDockerImagePytest(t *testing.T) {
switch {
case args[0] == "start":
return errMock
case args[0] == "inspect":
stdout.Write([]byte(`exit code 1`)) // making sure exit code is captured properly
return nil
default:
return nil
}
}
_, err = handler.Pytest("", "", "", "", []string{}, true, options)
out, err := handler.Pytest("", "", "", "", []string{}, true, options)
assert.Error(t, err)
assert.Equal(t, out, "exit code 1")
})

t.Run("copy error", func(t *testing.T) {
Expand Down

0 comments on commit 9a02d31

Please sign in to comment.