From 26fe59347aac1d6cfac9372d6d234d76314f3511 Mon Sep 17 00:00:00 2001 From: Johannes Mueller Date: Sat, 1 Jun 2024 17:18:00 +0200 Subject: [PATCH] Add support for pytest -x Fixes #28 --- test-cockpit-python.el | 4 +++- test/test-python.el-test.el | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test-cockpit-python.el b/test-cockpit-python.el index d37dea1..2d1642a 100644 --- a/test-cockpit-python.el +++ b/test-cockpit-python.el @@ -60,7 +60,8 @@ "--capture=no" "-k" "-m" - "--mypy")) + "--mypy" + "--exitfirst")) (defun test-cockpit-python--test-project-command (_ args) "Make the test project command from ARGS." @@ -143,6 +144,7 @@ [["Switches" ("-k" test-cockpit-python--restrict-substring) ("-f" "only lastly failed tests" "--last-failed") + ("-x" "exit after first fail" "--exitfirst") ("-b" "build extensions before testing" "build_ext") ("-m" test-cockpit-python--marker-switch) ("-M" "test type hints" "--mypy")] diff --git a/test/test-python.el-test.el b/test/test-python.el-test.el index 1cafc67..50c4b29 100644 --- a/test/test-python.el-test.el +++ b/test/test-python.el-test.el @@ -393,9 +393,10 @@ async def test_first_outer(): (should (equal (aref (aref infix 0) 0) "Switches")) (should (equal (car (aref (aref infix 0) 1)) "-k")) (should (equal (aref (aref infix 0) 2) '("-f" "only lastly failed tests" "--last-failed"))) - (should (equal (aref (aref infix 0) 3) '("-b" "build extensions before testing" "build_ext"))) - (should (equal (car (aref (aref infix 0) 4)) "-m")) - (should (equal (aref (aref infix 0) 5) '("-M" "test type hints" "--mypy"))) + (should (equal (aref (aref infix 0) 3) '("-x" "exit after first fail" "--exitfirst"))) + (should (equal (aref (aref infix 0) 4) '("-b" "build extensions before testing" "build_ext"))) + (should (equal (car (aref (aref infix 0) 5)) "-m")) + (should (equal (aref (aref infix 0) 6) '("-M" "test type hints" "--mypy"))) (should (equal (aref (aref infix 1) 0) "Output")) (should (equal (aref (aref infix 1) 1) '("-v" "show single tests" "--verbose"))) (should (equal (aref (aref infix 1) 2) '("-V" "verbose output" "-vv")))