Anonymous avatar Anonymous committed b18110e

Added support for xdist looponfailing and adjusted it so we change to the project root before running the test runner

Comments (0)

Files changed (1)

 (defvar pytest-project-root-test 'pytest-project-root)
 (defvar pytest-global-name "pytest")
 (defvar pytest-use-verbose nil)
+(defvar pytest-loop-on-failing nil)
 (defun run-pytest (&optional tests debug failed)
   "run pytest"
          (where (pytest-find-project-root))
          (args (concat (if debug "--pdb" "")
                        (if debug " " "")
-                       (if failed "-f" "")))
+                       (if pytest-loop-on-failing "-f" "")))
          (tnames (if tests tests "")))
-    (funcall (if debug
-                 'pdb
+    (funcall (if debug 'pdb
                '(lambda (command)
-                  (compilation-start command
-                                     nil
+                  (compilation-start command nil
                                      (lambda (mode) (concat "*pytest*")))))
-              (concat "%s "
-                      (if pytest-use-verbose "-v " "")
-                      "%s %s")
-              (pytest-find-test-runner) args tnames))))
+              (concat "cd %s && %s " (if pytest-use-verbose "-v " "") "%s %s")
+              where (pytest-find-test-runner) args tnames))))
 (defun pytest-all (&optional debug failed)
   "run all tests"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.