jerry-git / jerry-git/pytest-split

`setup_class` time is not considered

Offen
#106 1 Kommentar 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
325
Forks
56
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Considering a test case with `setup_class`:

```py
import time

class TestA:
@classmethod
def setup_class(cls):
time.sleep(6)

def test1(self):
time.sleep(2)

def test2(self):
time.sleep(3)
```

Run:
```sh
pytest test_a.py --store-durations
```

The result in `.test_durations`:
```
{
"test_a.py::TestA::test1": 8.008305040886626,
"test_a.py::TestA::test2": 3.003461800981313
}
```

Here, the `setup_class` time is counted in `test1`, but if `test1` and `test2` are split into different groups, `setup_class` in `test2` matters. To minimize the time, `pytest-split` should group them into the same group.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by reproducing the example with `pytest test_a.py --store-durations` and inspect how `.test_durations` is generated and how durations are used for grouping. The fix is done when `setup_class` cost is handled correctly if tests are split across groups, while tests in the same class are grouped together to avoid repeating that setup time.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
testing-qa
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
64/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.