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

Resolve test_convert_s3_path_sqlite test failures with explicit local_cache_dir #83

Merged
merged 6 commits into from
Aug 2, 2023

Conversation

d33bs
Copy link
Member

@d33bs d33bs commented Aug 1, 2023

Description

This PR seeks to address #81 where tests periodically fail with test_convert_s3_path_sqlite (see issue for greater specificity on the patterns associated). Initially I made the mistake of believing this was caused due to nested Pytest fixture behavior with temporary directories supplied to tests (see PR #79). This PR reverts those changes and adds different ones to prevent the same tests failures from persisting.

I believe this test is failing due to Cloudpathlib's default temporary cache behavior ("tmp_dir"). Two convert calls are made, both using the default temporary cache location to store the SQLite file locally. When the first convert completes, the second convert seems to begin the process of reading from the same cache location which seems to persist for a short time after the first convert completes. Eventually, the temporary directory supplied from Cloudpathlib is removed while the second convert is running. I hypothesize that tests only periodically fail due to how quickly they can generally run, with Python 3.8 (where the issue often occurs) missing performance improvements available to Python 3.9 and 3.10.

Detection of the missing source data file has gone undetected due to a missing raise for DuckDB exceptions when extracting data. A raise is added for these exceptions with #82 (where linting demonstrated a need through _get_table_columns_and_types changes during development). A Github Actions job run which exhibits the error with a raise may be found here. Full logs are attached here here for later reference in case they're purged.

After adding an explicit local_cache_dir value for these test runs of convert within test_convert_s3_path_sqlite I no longer have witnessed the issue occurring.

Thanks in advance for any thoughts and feedback on this PR!

What is the nature of your change?

  • Bug fix (fixes an issue).
  • Enhancement (adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • This change requires a documentation update.

Checklist

Please ensure that all boxes are checked before indicating that a pull request is ready for review.

  • I have read the CONTRIBUTING.md guidelines.
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have deleted all non-relevant text in this pull request template.

@d33bs d33bs requested review from falquaddoomi and gwaybio August 1, 2023 22:01
Copy link
Member

@gwaybio gwaybio left a comment

Choose a reason for hiding this comment

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

One comment that need not delay merging. Thanks!

tests/test_convert.py Outdated Show resolved Hide resolved
@d33bs
Copy link
Member Author

d33bs commented Aug 2, 2023

Thank you @gwaybio for your review! Merging now.

@d33bs d33bs merged commit 763ae8d into cytomining:main Aug 2, 2023
@d33bs d33bs deleted the resolve-testing-issue branch August 2, 2023 15:26
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