[New-bugs-announce] [issue45229] Always use unittest for collecting tests in regrtests

Serhiy Storchaka report at bugs.python.org
Fri Sep 17 03:31:12 EDT 2021

New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

Currently regrtest supports two ways of collecting and running tests in module.

1. If the module contains the "test_main" function, regrtest just calls it. This function usually calls run_unittest() with a list of test classes, composed manually, it can also run doctests with run_doctest(), generate list of test classes dynamically, and run some code before and after running tests.

2. Otherwise regrtest uses unittest for for collecting tests.

The disadvantage of the former way is that new test classes should be added manually to the list. If you forget to do this, new tests will not be run. See for example issue45185 and issue45187. Not runned tests can hide bugs.

So it would be better to eliminate human factor and detect tests automatically.

assignee: serhiy.storchaka
components: Tests
messages: 402006
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Always use unittest for collecting tests in regrtests
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list