-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
test: Merge _should_test_azure and _get_azure_url inside Azure test helper #3055
Conversation
ed5fe85
to
f828a3f
Compare
f828a3f
to
c4783f4
Compare
should_test = staticmethod(_should_test_azure) | ||
get_url = staticmethod(get_azure_url) | ||
@staticmethod | ||
def should_test(): |
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.
The logic is different from other should_test
, for example:
class GDrive:
@staticmethod
def should_test():
return os.getenv("GDRIVE_USER_CREDENTIALS_DATA") is not None
At least as credentials are set, it will run the tests.
But as I'm reading this, if DVC_TEST_AZURE
is defined, it is assumed that AZURE_STORAGE_{CONTAINER_NAME,CONNECTION_STRING}
are set.
Why not going for testing only the credentials?
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.
@MrOutis Gdrive is the only one that doesn't respect the previous convention 🙂 This change does. DVC_TEST*
are useful when you want to ensure that your tests will run even if the env vars are not defined, for example when you have some other way of providing credentials already. For example, should_test for s3 tests for AWS_ env vars, but I don't define them locally, since I have the default ones that work as is.
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.
@efiop , got it 👍
should_test = staticmethod(_should_test_azure) | ||
get_url = staticmethod(get_azure_url) | ||
@staticmethod | ||
def should_test(): |
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.
@efiop , got it 👍
I tried doing this in a single PR, but, it became fairly large. So, I'm just making a PR with a single change.
After merging all the functions inside
tests/remotes.py
, we could use the {Azure, S3, GCP, etc.} classes as mixins on theTestCase
s.Related to #2878.
❗ Have you followed the guidelines in the Contributing to DVC list?
📖 Check this box if this PR does not require documentation updates, or if it does and you have created a separate PR in dvc.org with such updates (or at least opened an issue about it in that repo). Please link below to your PR (or issue) in the dvc.org repo.
❌ Have you checked DeepSource, CodeClimate, and other sanity checks below? We consider their findings recommendatory and don't expect everything to be addressed. Please review them carefully and fix those that actually improve code or fix bugs.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏