New feature request - Run only a random subset of tests.

2024-02-12 Thread אורי
Django developers, I created https://code.djangoproject.com/ticket/35183 and was asked to start a discussion on the DevelopersMailingList. I'm requesting a new feature request - Run only a random subset of tests. tests - add a new argument "--test-only" (int, >=0) and If run with this argument, r

Re: New feature request - Run only a random subset of tests.

2024-02-12 Thread Jörg Breitbart
@Uri May I ask, whats the idea behind running a random subset of tests only? Wouldn't a Monte Carlo approach be highly unreliable, e.g. lure ppl into thinking everything is ok, but in reality the random test selection did not catch affected code paths? I mean for tests - its all about reliabi

Re: New feature request - Run only a random subset of tests.

2024-02-12 Thread Jörg Breitbart
Adding to my last comment: If you are looking for a more tailored unit testing with low test pressure and still high reliability - maybe coverage.py can give you enough code insights to build a tailored test index db to only run affected tests from current code changes. I am not aware of test

Re: New feature request - Run only a random subset of tests.

2024-02-12 Thread אורי
Hi Jörg, All our tests are tested anyway with GitHub Actions. The idea is to run a subset of tests locally to catch 90% of the problems before I commit and wait 40 minutes for all the tests to run. It works most of the time. Of course the whole tests should be run before deploying to production, b

Re: New feature request - Run only a random subset of tests.

2024-02-12 Thread אורי
Hi, Also, sometimes I just want to see how many tests are in a specific module, without running them. So I can just run `./tests_manage_all_sites_with_all_warnings.sh test speedy.net --test-only 0 --test-all-languages` which gives me the number of tests in speedy.net, or any module I need. There i

Re: New feature request - Run only a random subset of tests.

2024-02-12 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
I’d be against this. I think this approach would be counterproductive in most cases due to the high probability of a false positive. Including it as a core feature is not necessary when it can be added through a third party package. On Mon, Feb 12, 2024, at 2:22 PM, אורי wrote: > Hi, > > Also,

Re: New feature request - Run only a random subset of tests.

2024-02-12 Thread Jörg Breitbart
I also think that your requirements are too specific to be added to django. You are prolly better suited by creating your own test picking abstraction for this, e.g. by writing custom test suite aggregates or using unittest.TestLoader.discover and going into tests of interest by your own logic

Re: Testing Unmanaged Models - Using the SchemaEditor to create db tables

2024-02-12 Thread Emmanuel Katchy
Hi Adam, Thanks for your response! I understand your point about unmanaged models being a niche use case of Django. I've decided to proceed with creating a package and see how it goes. The new enterContext() and other methods in unittest seem interesting. I'll definitely be using them more fro