Skip to content

Commit 5a4f286

Browse files
committed
tests: raise command error with exit code if non-zero (bug 1887042)
1 parent c52e80b commit 5a4f286

File tree

1 file changed

+4
-2
lines changed
  • src/lando/utils/management/commands

1 file changed

+4
-2
lines changed

src/lando/utils/management/commands/tests.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import subprocess
22

33
from django.conf import settings
4-
from django.core.management.base import BaseCommand
4+
from django.core.management.base import BaseCommand, CommandError
55

66
ROOT_DIR = settings.BASE_DIR.parent.parent
77

@@ -30,4 +30,6 @@ def handle(self, *args, **options):
3030
if options["paths"]:
3131
command += options["paths"]
3232

33-
subprocess.call(command, cwd=ROOT_DIR)
33+
exit_code = subprocess.call(command, cwd=ROOT_DIR)
34+
if exit_code:
35+
raise CommandError(f"Pytest exited with exit code {exit_code}")

0 commit comments

Comments
 (0)