OCA / bank-statement-import

Bank Import Addons
https://odoo-community.org/psc-teams/banking-10
GNU Affero General Public License v3.0
152 stars 412 forks source link

[16.0][IMP] account_statement_import_camt: refactor tests for inheritability #676

Closed SilvioC2C closed 7 months ago

SilvioC2C commented 7 months ago

This refactoring will allow using TestParser._do_parse_test() method for subclasses defined in inheriting modules.

This way, if the new module defines new files in other paths than account_statement_import_camt/test_files/, subclasses of TestParser will still be able to use the _do_parse_test() method for imports and checks.

Moreover, a custom value can now be defined for the acceptable differing lines number between inputfile and goldenfile.

It will also maintain backward compatibility with the current usage of the method (ie: using only a filename with the assumption of finding it in account_statement_import_camt/test_files/).

NB: methods are now defined outside of TestParser to allow importing them directly, instead of inheriting from TestParser.

SilvioC2C commented 7 months ago

this method seems not tied at all to the class: I would make it a simple function to call from everywhere w/o having to inherit this class (which btw has tests and will be inherited as well).

I'll create an external function that can be safely imported by other modules, and then the class's method will simply redirect to it

SilvioC2C commented 7 months ago

@simahawk mind reviewing?

simahawk commented 7 months ago

/ocabot merge patch

OCA-git-bot commented 7 months ago

This PR looks fantastic, let's merge it! Prepared branch 16.0-ocabot-merge-pr-676-by-simahawk-bump-patch, awaiting test results.

OCA-git-bot commented 7 months ago

Congratulations, your PR was merged at 8218245c544df2edf145d116d3795db695c8243a. Thanks a lot for contributing to OCA. ❤️