Skip to content

Commit

Permalink
Add support for python log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-mueller committed Feb 20, 2024
1 parent 2fcd6cc commit 11c23dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion test-cockpit-python.el
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"--no-cov"
"--cov"
"--cov-report"
"-rFP"
"-r"
"--log-level"
"--disable-warnings"
"--capture=no"
"-k"
Expand Down Expand Up @@ -129,6 +130,14 @@
:key "-m"
:argument "-m")

(transient-define-infix test-cockpit-python--choose-loglevel ()
:class 'transient-switches
:key "-l"
:argument-format "--log-level=%s -rA"
:argument-regexp "\\(--log-level=\\(debug\\|info\\|warn\\|error\\) -rA\\)"
:choices '("debug" "info" "warn" "error")
:description "log level")

(defun test-cockpit-python--infix ()
"Setup the pytest specific test switches."
[["Switches"
Expand All @@ -140,6 +149,7 @@
["Output"
("-v" "show single tests" "--verbose")
("-V" "verbose output" "-vv")
(test-cockpit-python--choose-loglevel)
("-c" "print coverage report" "--cov-report=term-missing")
("-r" "report output of passed tests" "-rFP")
("-w" "don't output warnings" "--disable-warnings")
Expand Down
8 changes: 4 additions & 4 deletions test/test-python.el-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ async def test_first_outer():
(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")))
(should (equal (aref (aref infix 1) 3) '("-c" "print coverage report" "--cov-report=term-missing")))
(should (equal (aref (aref infix 1) 4) '("-r" "report output of passed tests" "-rFP")))
(should (equal (aref (aref infix 1) 5) '("-w" "don't output warnings" "--disable-warnings")))
(should (equal (aref (aref infix 1) 6) '("-n" "don't capture output" "--capture=no"))))))
(should (equal (aref (aref infix 1) 4) '("-c" "print coverage report" "--cov-report=term-missing")))
(should (equal (aref (aref infix 1) 5) '("-r" "report output of passed tests" "-rFP")))
(should (equal (aref (aref infix 1) 6) '("-w" "don't output warnings" "--disable-warnings")))
(should (equal (aref (aref infix 1) 7) '("-n" "don't capture output" "--capture=no"))))))

0 comments on commit 11c23dd

Please sign in to comment.