-
Notifications
You must be signed in to change notification settings - Fork 570
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
Refacto Repository tests #1277
Merged
Merged
Refacto Repository tests #1277
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The documentation is not available anymore as the PR was closed or merged. |
LysandreJik
approved these changes
Jan 11, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner this way! Thanks for the refactor @Wauplin.
Thanks @LysandreJik for the review and sorry again for the big diff to review. I'll fix conflicts, wait for the checks and merge it :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TL;DR:
/tmp
dirFirst of all, sorry for the huge diff in the PR 😢 .
I started it as a preliminary work for #1112 (Windows CI):
"directory/whatever_file.txt"
as it breaks on WindowsWORKING_DIR_FIXTURE
to replace it by a proper/tmp
folder=> Avoid to have to clean it after tests (when tests were failing, I often ended up with untracked folders in my
huggingface_hub
folder that I had to delete)TestRepositoryShared
andTestRepositoryUniqueRepos
. In shared test, a single repo is created on the Hub and cloned multiple times. No files are pushed to this repo during the tests.=> Save quite some time of setup/teardown. In Unique test, a repo is created per test (same as before) so that they are independent from each other.
self.repo_id
,self.repo_path
andself.repo_url
and an helperself.clone_from(...)
to avoid reduncancy (e.g. recomputingrepo_id=f"{USER}/{self.REPO_NAME}", local_dir="{WORKING_DIR}/{REPO_NAME}"
all the time).=> Now we have a
Repository
test suite that should be "iso" compared to before but running in parallel (~1min instead of 8) and on Windows.(*) For example in dataset tests, we are testing that cloning from a different repo type works. But also testing that we can commit, pull, push,... which is quite redundant because what we really want is to check if a repo can be cloned with a repo_type. All subsequent actions are already tested separately ("test only 1 feature at a time").
(EDIT: "non repository" tests are failing but it's not due to this PR 😕)