On Thu, Mar 10, 2022 at 10:41 PM Ian Haywood <ian@haywood.id.au> wrote:


On 26/02/2022 1:00 am, Jean-Paul Calderone wrote:
On Thu, Feb 24, 2022 at 5:22 PM Ian Haywood <ian@haywood.id.au>   

From just a quick skim of the part of the implementation dealing with `--until-failure` behavior, I guess that I would try to refactor so that `trial -u -jN` and `trial -u` share their implementation of this functionality instead of each implementing it separately.  If `trial -u` already has tests and you can get rid of the dedicated `trial -u -jN` code that's a big step towards the testing goal - and always better to delete unnecessary code than to keep it, fix it, and have to write and maintain tests for it.

However, like I said, I only gave the code a brief skim.  For all I know, there is some major hurdle in the way of such a refactoring.

it appears trial is almost two programs in one: a distributed and a non-distributed version. Obviously -jN selects which version you get and the decision is made very early: in scripts/trial

So IMHO single implementation of -u isn't possible.


It seems like some substantial refactoring will be required before a single implementation is possible, anyway.

One idea that might be worth exploring is to have trial without `--jobs` be equivalent to `trial --jobs=1` (with no degradation in functionality).  This would be one way to remove one of the two programs in trial.
 

I have a minimalist solution to #10312

https://github.com/twisted/twisted/pull/1702


Thanks.  That is so succinct that it seems worth landing quickly and dealing with any further factoring improvements to trial separately.  I took the liberty of pushing a test for the fix and a news fragment.

Sadly this pushes the total line count of the diff above 10 ... but only to 11.  I hope someone is available for a prompt review.  If any non-committer wants to start learning how to get involved in Twisted development, this is a great ticket / PR to jump in with - the code change itself is very simple, leaving plenty of attention for learning the process.

Jean-Paul