Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] l10n_it_fatturapa_in: test improvement #3479

Closed
wants to merge 1 commit into from

Conversation

TheMule71
Copy link
Contributor

Make one test independent from others (to be excuted in isolation)

Copy link
Contributor

@sergiocorato sergiocorato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forse si ottiene lo stesso risultato rinominando il test in modo che venga eseguito nell'ordine corretto? tipo test_54_duplicated_vat_on_partners

@TheMule71
Copy link
Contributor Author

Forse si ottiene lo stesso risultato rinominando il test in modo che venga eseguito nell'ordine corretto? tipo test_54_duplicated_vat_on_partners

Sì ma il punto è quello di renderlo eseguibile separatamente. I test dovrebbero dipendere solo da oggetti creati a livello di setUp (o ancora meglio a livello di classe), in modo che l'ambiente sia ben documentato. Avere un test che dipende da un side-effect di un test eseguito precedentemente oltre che impedire l'esecuzione singola del test (molto utile in caso debug), crea anche un potenziale problema futuro se i test precedenti vengono modificati/migliorati.

@sergiocorato
Copy link
Contributor

/ocabot rebase

Make one test independent from others (to be excuted in isolation)
@OCA-git-bot
Copy link
Contributor

Congratulations, PR rebased to 14.0.

Copy link
Contributor

@SirAionTech SirAionTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grazie della PR!
Ho proposto un'altra soluzione, secondo me più lineare, ma non vedo problemi con quella proposta

invoice_id = res.get("domain")[0][2][0]
invoice = self.invoice_model.browse(invoice_id)
invoice.ref = invoice.payment_reference = "14dupvat"
supplier = self.env["res.partner"].search(
Copy link
Contributor

@SirAionTech SirAionTech May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quindi per assurdo, questo test non è coperto dai test!
Non si potrebbe invece usare un'altra partita IVA che non è ancora stata usata per questo partner? Ho trovato https://strumentidev.it/generatore/partita-iva per generarne di valide.

Ho usato questa soluzione in 4d74656 (di #3810)

@sergiocorato
Copy link
Contributor

Forse si ottiene lo stesso risultato rinominando il test in modo che venga eseguito nell'ordine corretto? tipo test_54_duplicated_vat_on_partners

Sì ma il punto è quello di renderlo eseguibile separatamente. I test dovrebbero dipendere solo da oggetti creati a livello di setUp (o ancora meglio a livello di classe), in modo che l'ambiente sia ben documentato. Avere un test che dipende da un side-effect di un test eseguito precedentemente oltre che impedire l'esecuzione singola del test (molto utile in caso debug), crea anche un potenziale problema futuro se i test precedenti vengono modificati/migliorati.

Ho riletto questa PR, questi test sono di tipo SingleTransactionCase per cui è normale che vengano eseguiti tutti di seguito con una dipendenza uno dall'altro.
Se si intende tenerli separati si può usare SavepointCase no?

Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 22, 2024
@github-actions github-actions bot closed this Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14.0 approved missing issue stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants