matplotlib / matplotlib/pytest-mpl

Support hierarchical tests

Aperta
#85 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
272
Fork
53
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,

I am working a lot with images and therefore love the idea of the project. I played around with it a little bit and noticed something.

When I group my tests in classes, the image file gets named only after the function that calls it.

Example:

class Test_Imageutils:
    @pytest.mark.mpl_image_compare
    def test_put_text(self):
        from skimage import data
        astronaut = data.astronaut()
        annotated = imageutils.put_text(astronaut.copy(), "hi", loc="center")
        fig, ax = plt.subplots(1, 1, figsize=(6, 6))
        ax.imshow(annotated)
        return fig

And the image in baseline is named test_put_text.png

I think it would be a great idea to add an option to write the full hierarchy, either into folders or into the file name. For example

  • baseline/Test_Imageutils/test_put_text.png
  • baseline/Test_Imageutils-test_put_text.png

What do you think?

I could dig a little into the code and come up with a PR if anyone thinks it is a good idea.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando il codice che ricava i nomi delle immagini di baseline dai test pytest, usando l’esempio Test_Imageutils/test_put_text come caso atteso. Confronta gli approcci basati su cartelle e nomi di file descritti nell’issue, quindi definisci l’opzione e verifica che i nomi gerarchici vengano generati in modo coerente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
matplotlib, python
Ambito
testing-qa
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.