[16.0][REF][l10n_br_base][l10n_br_fiscal][l10n_br_account] tests don't depend on demo #3563
+241
−120
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.
both Odoo SA and the OCA recommend that tests don't depend on demo data. Here I'm starting this cleanup on the most central modules. Benefits include:
We have long wished to achieve that in the project. However, in l10n-brazil we need to maintain both complex fiscal demo data and fiscal test fixtures. That is why until now the test fiscal transactions where based on demo data.
In this PR, I created a simple framework (with l10n_br_base/tests/tools.py and l10n_br_fiscal/tests/tools.py) where we can load the SAME fiscal demo data both for the demo mode and for the tests even on databases created without demo data (like with the --without-demo=all param). I had to clean up a bit useless relations to demo data in the fiscal demo data and work around the demo data of the product module.
As we tend to reload the same fiscal demo fixtures in several tests, tests are a bit slower. But: