automl/auto-sklearn

Convert some `unittest` tests to `pytest` style

Open

#1,351 opened on Dec 20, 2021

View on GitHub
 (12 comments) (0 reactions) (0 assignees)Python (7,270 stars) (1,265 forks)batch import
Good first issuemaintenance

Description

Some of our tests follow the unittest structure of creating tests. While these are fine, we want to migrate our tests to be in the more functional style of pytest.

For example, test_classification which tests the classification pipeline adopts the unittest style of class structured tests in which you must understand the whole setup to often understand one test.

In contrast, a more functional pytest looks like test_estimators.py::test_fit_performs_dataset_compression. Here we can define the test entirely through parameters, specify multiple parameter combinations, document which ones we expect to fail and give a reason for it. Because the test is completely defined through parameters, we can document each parameter and make the test almost completely-transparent by just looking at that one test.

We would appreciate any contributors on this side who want to get more familiar or are already familiar with testing. Some familiarity or willingness to learn pytest's @parametrize and @fixture features is a must. Please see the contribution guide if you'd like to get started!

Contributor guide