jerry-git / jerry-git/pytest-split
Splits invalid when collection order not deterministic
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 325
- Forks
- 56
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
The big assumption underlying the two splitting algorithms is that the order of collected items is constant.
However, I've come across a case where this assumption was violated.
In my case I had a test parametrised with pytest.mark.parametrize, but the items to parametrize with would sometimes change order.
Take this example:
import pytest
@pytest.mark.parametrize('name', set(['henk', 'ingrid']))
def test_hello(name):
pass
If you run this often enough you'll see that the order changes:
[2021-06-17 22:47:10] test_temp.py::test_hello[henk] PASSED [ 50%]
[2021-06-17 22:47:10] test_temp.py::test_hello[ingrid] PASSED [100%]
and
[2021-06-17 22:47:10] test_temp.py::test_hello[ingrid] PASSED [ 50%]
[2021-06-17 22:47:10] test_temp.py::test_hello[henk] PASSED [100%]
I'm not sure how to address this, but I think there are a few options:
- not splitting over different values of
parametrizefor the same test. In other words, make sure that a single group will run all tests fortest_hello. - try to create some deterministic order out of test cases by sorting. I'm not sure this will work in all cases tho (for example it might not work for objects)
- do splitting on one machine, save the splits and just call
pytestwith those pre-calculated groups (so not really using this plugin as a plugin :p)
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez la variation de l’ordre avec l’exemple pytest.mark.parametrize, puis suivez les deux algorithmes de division ; aucun chemin de fichier ni aucun test n’est fourni. Comparez les stratégies de gestion proposées et considérez l’issue comme résolue lorsque des exécutions répétées affectent les tests collectés à des groupes cohérents sans interrompre la collecte de pytest.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- testing
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- À clarifier
- Accessibilité débutants
- 38/100