-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add tests command (bug 1887042)
- add tests management command that runs pytest - invoke command from github workflow
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ jobs: | |
source env/bin/activate | ||
lando migrate | ||
lando test | ||
pytest src/lando/api | ||
lando tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import subprocess | ||
|
||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
|
||
ROOT_DIR = settings.BASE_DIR.parent.parent | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Run pytest" | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument( | ||
"--exitfirst", | ||
"-x", | ||
action="store_true", | ||
help="Exit instantly on first error or failed test" | ||
) | ||
|
||
def handle(self, *args, **options): | ||
command = ["pytest"] | ||
|
||
if options["exitfirst"]: | ||
command.append("-x") | ||
|
||
subprocess.call(command, cwd=ROOT_DIR) |