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

DISCO-3182 Remove duplicated fixtures #773

Merged
merged 1 commit into from
Jan 29, 2025
Merged

Conversation

gruberb
Copy link
Member

@gruberb gruberb commented Jan 29, 2025

References

JIRA: DISCO-3182

Description

Remove duplicated test fixtures.

PR Review Checklist

Put an x in the boxes that apply

  • This PR conforms to the Contribution Guidelines
  • The PR title starts with the JIRA issue reference, format example [DISCO-####], and has the same title (if applicable)
  • [load test: (abort|skip|warn)] keywords are applied to the last commit message (if applicable)
  • Documentation has been updated (if applicable)
  • Functional and performance test coverage has been expanded and maintained (if applicable)

@gruberb gruberb requested a review from a team January 29, 2025 13:00
Copy link
Contributor

@misaniwere misaniwere left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning this up! There are a few things left to cleanup:

  • gcs_blob_mock was previously a fixture that returned a function and there's still traces of that in the code where it is being used as a function. e.g gcs_blob_mock(blob_json, "manifest.json")
  • There are tests that are are defining mock objects when we have access to gcs_blob_mock, for example, this line can be changed to gcs_bucket_mock.get_blob.return_value = gcs_blob_mock
  • There are multiple test methods in manifest and top picks folders where we're passing in fixtures and then not using them. for example, here

These are just a few instances where we can refactor/clean up fixtures but there are more opportunities to tighten up the code here. Let me know if you need more clarification, happy to hop on a call :)

@gruberb gruberb force-pushed the DISCO-3182-remove-dups branch from 40ce58d to c470a03 Compare January 29, 2025 16:12
@gruberb gruberb requested a review from misaniwere January 29, 2025 16:13
@gruberb gruberb force-pushed the DISCO-3182-remove-dups branch from c470a03 to 8b0f93a Compare January 29, 2025 17:15
Copy link
Contributor

@misaniwere misaniwere left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

) -> None:
"""Test that the get_file method returns manifest data."""
manifest_remote_filemanager.gcs_client = MagicMock()
manifest_remote_filemanager.gcs_client.get_file_by_name.return_value = gcs_blob_mock
gcs_blob_mock.download_as_text.return_value = blob_json

get_file_result_code, result = manifest_remote_filemanager.get_file()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we add a success check for get_file_result_code or change to _ since it's an unused variable

Copy link
Member Author

Choose a reason for hiding this comment

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

Added!

@gruberb gruberb force-pushed the DISCO-3182-remove-dups branch from 8b0f93a to d7e5410 Compare January 29, 2025 19:14
@gruberb gruberb added this pull request to the merge queue Jan 29, 2025
Merged via the queue into main with commit 06c0aef Jan 29, 2025
11 checks passed
@gruberb gruberb deleted the DISCO-3182-remove-dups branch January 29, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants