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

[16.0][IMP] fs_storage: compute options protocol + refactor test class for re-use #314

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

len-foss
Copy link
Contributor

Before the change, reading the options protocol might not be in sync with the record protocol.
This is particularly the case if the record is save in the middle of editing as the value resets, which can be quite confusing.

Before the change, reading the options protocol might not be in sync
with the record protocol.
This is particularly the case if the record is save in the middle of editing
as the value resets, which can be quite confusing.
@len-foss len-foss force-pushed the 16.0-impoptprotocol-len branch from 294f70d to c9ccb24 Compare December 14, 2023 09:45
@len-foss
Copy link
Contributor Author

@lmignon really tiny change but it makes things a bit easier, as while setting options the user might get confused between host/url/endpoint that mean the same thing but have a different key depending on the protocol.

@len-foss
Copy link
Contributor Author

I've also added a split of the test class to be able to reuse it in other modules (in particular to work on dms_storage).

Copy link
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

Thank you @len-foss LTGM
It's indeed less confusing for the end user

@len-foss
Copy link
Contributor Author

So I've pushed another commit to help test other module that might depend on fs_storage.
While working on OCA/dms#275, as soon as there are more than one test that are run, the file would be created on a tmp_dir_1 and then the very next following file read would be on tmp_dir_2. It can be really maddening, so I think having a test class that resist these pain points can be really helpful.

@len-foss len-foss changed the title [16.0][IMP] fs_storage: compute options protocol [16.0][IMP] fs_storage: compute options protocol + refactor test class for re-use Dec 15, 2023
@@ -1 +1,2 @@
from . import common
Copy link
Contributor

Choose a reason for hiding this comment

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

there's no need to import common here

if os.path.exists(self.temp_dir):
shutil.rmtree(self.temp_dir)

def _create_file(self, backend: FSStorage, filename: str, filedata: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we need this method... are we going to end up w/ all the possible methods of the backend?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is part of the original code that has just been moved. If you look at the individual commits, the only change is 2ad064e

It makes it easier to re-use the backend and to test with 'optimize paths', which works with subfolders.

@lmignon
Copy link
Contributor

lmignon commented Dec 20, 2023

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-314-by-lmignon-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 5a1f97c into OCA:16.0 Dec 20, 2023
6 checks passed
@OCA-git-bot
Copy link
Contributor

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

@len-foss len-foss deleted the 16.0-impoptprotocol-len branch December 20, 2023 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants