[18.0][REF] l10n_br_base, l10n_br_fiscal, l10n_br_nfse: decouple tests from demo data #4326
+312
−105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the tests for
l10n_br_base,l10n_br_fiscal, andl10n_br_nfseto remove their dependency on the global Odoo demo data loading mechanism.Context & Motivation
Historically,
l10n-braziltests relied on complex fiscal demo data. This created several issues:--without-demo=all.This work follows the pattern I previously proposed for 16.0 in PR #3563 and aligns with Odoo SA and OCA guidelines to keep tests independent of demo data.
Implementation Details
I introduced a lightweight fixture loading framework (see
l10n_br_base/tests/tools.pyandl10n_br_fiscal/tests/tools.py) that allows tests to:setUpClassof the test transaction.base.res_partner_1orproduct.product_product_1) if they don't exist, preventing crashes on empty databases.Benefits
Modules Covered
l10n_br_basel10n_br_fiscall10n_br_nfseDependencies like
l10n_br_fiscal_edi,l10n_br_fiscal_certificate, etc., do not rely on demo data and thus required no changes.