Keeping failing test ids for git bisect
Hi! Is there a way to run a bunch of tests like with --lf but don't clear the cache when they pass? This would be mighty helpful for git bisect. For now I helped myself by copying the test ids, but that requires editing the list copied from the terminal before being able to paste them to the command line. Regards, Florian Schulze
Hey, On Thu, May 02, 2019 at 11:22:08AM +0200, Florian Schulze wrote:
Is there a way to run a bunch of tests like with --lf but don't clear the cache when they pass? This would be mighty helpful for git bisect. For now I helped myself by copying the test ids, but that requires editing the list copied from the terminal before being able to paste them to the command line.
I've needed something similar before (like when I want to run a set of failing tests, but maybe run some other set in between). What would be nice is something like a --save-collected <name> and --load-collected <name>. Then you could do "--lf --save-collected bisect" once, and do "--load-collected bisect" to rerun exactly those tests. I wanted to write a plugin for that for months (if not years) now, but never got around to it. So far I've also done what you described. Florian (the other one :P) -- https://www.qutebrowser.org | me@the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/
On 2 May 2019, at 11:28, Florian Bruhin wrote:
Hey,
On Thu, May 02, 2019 at 11:22:08AM +0200, Florian Schulze wrote:
Is there a way to run a bunch of tests like with --lf but don't clear the cache when they pass? This would be mighty helpful for git bisect. For now I helped myself by copying the test ids, but that requires editing the list copied from the terminal before being able to paste them to the command line.
I've needed something similar before (like when I want to run a set of failing tests, but maybe run some other set in between).
What would be nice is something like a --save-collected <name> and --load-collected <name>. Then you could do "--lf --save-collected bisect" once, and do "--load-collected bisect" to rerun exactly those tests.
I wanted to write a plugin for that for months (if not years) now, but never got around to it. So far I've also done what you described.
Any hints on which hooks would be most useful for gathering the failing tests (or maybe a hint for existing code to look at)? Then I might write that plugin :) Regards, Florian Schulze
Any hints on which hooks would be most useful for gathering the failing tests (or maybe a hint for existing code to look at)? Then I might write
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Florians, that plugin :) I suggest to take a look at the implementation of the LFPlugin, which uses this hook to identify if a test passed/failed: https://github.com/pytest-dev/pytest/blob/f17b734989f07de2317bb60191bf51a475... This might give you some ideas on how to write such a plugin. Cheers, -----BEGIN PGP SIGNATURE----- Version: FlowCrypt 6.7.7 Gmail Encryption Comment: Seamlessly send and receive encrypted email wsFcBAEBCgAGBQJcytNdAAoJEAcNJkopMu2+rxYP/R1ZOcJ16hC5Hz6YkawI Kv533DJCLWU3VLEDHrzjDp0G+Qx2UbXGiHeypCOH0ph8AE3a2AP4naUEgk7A J2IrIx3lVGuApcq+apf4GXYLPihB7qaNyjnOJT35wwbqoI37R7tWZrT76TRn 5/Y9N4tB+fM9XwpDZUay4VZA+YiNHzHgG/xZxuXUvNyXPDQm27e4q+TcL6gw l9/tm2Hcbfz78FMMMPwhZnph7yLHrcCfW4B874xz2qaQp5SyFbE8rJfrb6f8 r9LKDT/QaBQZqHEIoYIHpdMHzqB/e/gaz3KZLeyRAYbJQsJQClo2sQc6VE2c X5wh88LYTnPtQdRYLXmlElzrbJe77vQ4FrHJmdZGFm6UptPE3uP90LVY+a/6 x3XMciuu+zRFulCzZFKulI6IoS1ER39wSqe7iUe/13irJ1ZfhPcwzJA+fqxi 0SsABPwPQcdDQGf3NZUBv0efZJz/o+pCoSgg4Al7fa+uoykeY05I8LQUfcnW xSIA/XCnT6xAYKxQfw6LwLJuU+hcgHUeLqR16DcPgqGf8K707fhUrGQah4uU xFlRLFYvcQ1cXb7rQdE4RBPgynUdTr45AR0EoACG8LeiaVzNk9sV6r5xZU3m Ygf6e3hKrxv88+D6tn69+s75U7ETcjzwxW1xrizZuaPuC4QxdMrwzVc+ULDp hX/c =nD0t -----END PGP SIGNATURE-----
On 02.05.19 11:28, Florian Bruhin wrote:
Is there a way to run a bunch of tests like with --lf but don't clear the cache when they pass?
What would be nice is something like a --save-collected <name> and --load-collected <name>. Then you could do "--lf --save-collected bisect" once, and do "--load-collected bisect" to rerun exactly those tests.
I wanted to write a plugin for that for months (if not years) now, but never got around to it. So far I've also done what you described.
See https://github.com/pytest-dev/pytest/issues/5073 for general improvements for the last-failed plugin, and https://github.com/pytest-dev/pytest/issues/1017 from 2016 for this specific issue. I think this should be addressed/fixed there, instead of creating a new plugin. As for workarounds, I've used to do `cp -a .pytest_cache/v/cache/lastfailed{,.stash}` (and the other way around) also. But a better workaround is using a wrapper that puts the cache in its own Git directory, allowing for `p-cache commit -a -m saved`, `p-cache checkout .` etc then. (it also clearly showed a problem with the --newest-first plugin (#5206)). ``` #!/bin/sh # Wrapper around git in .pytest_cache/v/cache. set -e # TODO: could use `m=((../)#.pytest_cache(N))` in Zsh for upward search. root=.pytest_cache/v/cache if ! [ -d "$root" ]; then error "Directory $root does not exist" fi cd "$root" if ! [ -e ".git" ]; then git init . git commit --allow-empty -m "init" git add --all . git commit -m "initial state" fi git "$@" ```
On 4 May 2019, at 1:34, Daniel Hahler wrote:
I wanted to write a plugin for that for months (if not years) now, but never got around to it. So far I've also done what you described.
See https://github.com/pytest-dev/pytest/issues/5073 for general improvements for the last-failed plugin, and https://github.com/pytest-dev/pytest/issues/1017 from 2016 for this specific issue.
I think this should be addressed/fixed there, instead of creating a new plugin.
As can be seen from the attempts Ronny made, it's hard to get it right. That's why I think this should evolve in a plugin and can eventually be moved to core. The issues showed me several use cases I didn't think about and I think it's not trivial to find a good cli ui for all of them. Regards, Florian Schulze
participants (4)
-
Daniel Hahler -
Florian Bruhin -
Florian Schulze -
nicoddemus@gmail.com