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

PR: tests/unit/test_source: cleanup, parametrize, and increase test coverage #1772

Merged
merged 14 commits into from
Aug 17, 2023

Conversation

bigtedde
Copy link
Collaborator

@bigtedde bigtedde commented Aug 9, 2023

Description

In this PR, I cleaned up the test_source module by splitting the paste_text() testing into its own separate test. I then parametrized test_paste_text() to cover more use/edge cases. Finally, I added in tests for removing a source from the sources table, as well as testing the source update button.

Related Issue

#1754

Motivation and Context

One of my Google Summer of Code projects involves cleaning up the Vorta tests, reducing duplicated code, and increasing code coverage.

How Has This Been Tested?

Tests work locally by running pytest, and they pass the GitHub CI checks.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

qtbot.waitUntil(lambda: tab.sourceFilesWidget.rowCount() == 2, **pytest._wait_defaults)
assert tab.sourceFilesWidget.rowCount() == 2
# Wait for directory sizing to finish
qtbot.waitUntil(lambda: len(qapp.main_window.sourceTab.updateThreads) == 0, **pytest._wait_defaults)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This line is causing problems with the linux tests most of the time, but not always. Never seems to have trouble on darwin. Might need to do more digging here. @m3nu @real-yfprojects have either of y'all encountered errors caused by updateThreads before?

Specifically, updateThreads is not not getting set back to 0 and the wait times out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved - this needs to be called after each test. Moved to fixture teardown.

yield main, tab

# Wait for directory sizing to finish
qtbot.waitUntil(lambda: len(qapp.main_window.sourceTab.updateThreads) == 0, timeout=2000)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After some digging, I discovered this wait needs to be done after each source test that involves updateThreads. I added this to the source_env fixture to happen at teardown.

@bigtedde bigtedde marked this pull request as ready for review August 10, 2023 18:41
m3nu
m3nu previously approved these changes Aug 16, 2023
@m3nu m3nu merged commit 2caa093 into borgbase:master Aug 17, 2023
@bigtedde bigtedde deleted the source_tests branch August 17, 2023 17:14
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