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

Refactor tests to use fixtures #797

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Conversation

michelletran-codecov
Copy link
Contributor

@michelletran-codecov michelletran-codecov commented Oct 17, 2024

This is because the tests were failing on duplicate keys. Fixtures reuses existing objects, which avoids creating objects with duplicate keys.

This was also extracted from #729 .

Also, since I also got rid of the Test Class, there's also a lot of white space changes. I would suggest selecting Hide whitespace when reviewing this.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-staging
Copy link

codecov-staging bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #797      +/-   ##
==========================================
- Coverage   98.00%   98.00%   -0.01%     
==========================================
  Files         443      443              
  Lines       36566    36532      -34     
==========================================
- Hits        35838    35804      -34     
  Misses        728      728              
Flag Coverage Δ
integration 98.00% <100.00%> (-0.01%) ⬇️
unit 98.00% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.87% <ø> (ø)
OutsideTasks 97.99% <100.00%> (ø)
Files with missing lines Coverage Δ
database/tests/factories/core.py 99.39% <100.00%> (ø)
tasks/tests/unit/test_brolly_stats_rollup.py 96.20% <100.00%> (+0.14%) ⬆️
tasks/tests/unit/test_commit_update.py 100.00% <ø> (ø)
tasks/tests/unit/test_sync_pull.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_upload_task.py 99.09% <ø> (ø)

@codecov-qa
Copy link

codecov-qa bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.00%. Comparing base (3aca4aa) to head (8d85121).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #797      +/-   ##
==========================================
- Coverage   98.00%   98.00%   -0.01%     
==========================================
  Files         443      443              
  Lines       36566    36532      -34     
==========================================
- Hits        35838    35804      -34     
  Misses        728      728              
Flag Coverage Δ
integration 98.00% <100.00%> (-0.01%) ⬇️
unit 98.00% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.87% <ø> (ø)
OutsideTasks 97.99% <100.00%> (ø)
Files with missing lines Coverage Δ
database/tests/factories/core.py 99.39% <100.00%> (ø)
tasks/tests/unit/test_brolly_stats_rollup.py 96.20% <100.00%> (+0.14%) ⬆️
tasks/tests/unit/test_commit_update.py 100.00% <ø> (ø)
tasks/tests/unit/test_sync_pull.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_upload_task.py 99.09% <ø> (ø)

Copy link

codecov-public-qa bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.00%. Comparing base (3aca4aa) to head (8d85121).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #797      +/-   ##
==========================================
- Coverage   98.00%   98.00%   -0.01%     
==========================================
  Files         443      443              
  Lines       36566    36532      -34     
==========================================
- Hits        35838    35804      -34     
  Misses        728      728              
Flag Coverage Δ
integration 98.00% <100.00%> (-0.01%) ⬇️
unit 98.00% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.87% <ø> (ø)
OutsideTasks 97.99% <100.00%> (ø)
Files Coverage Δ
database/tests/factories/core.py 99.39% <100.00%> (ø)
tasks/tests/unit/test_brolly_stats_rollup.py 96.20% <100.00%> (+0.14%) ⬆️
tasks/tests/unit/test_commit_update.py 100.00% <ø> (ø)
tasks/tests/unit/test_sync_pull.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_upload_task.py 99.09% <ø> (ø)

This is because the tests were failing on duplicate keys. Fixtures reuses existing
objects, which avoids creating objects with duplicate keys.
Because pullid=1 was removed from the CommitFactory (due to unintended consequences of creating a Pull object),
we now need to be explicit about setting it in a few places.
@michelletran-codecov michelletran-codecov marked this pull request as ready for review October 17, 2024 20:05
@michelletran-codecov michelletran-codecov requested a review from a team October 17, 2024 20:06
@michelletran-codecov michelletran-codecov added this pull request to the merge queue Oct 21, 2024
Merged via the queue into main with commit 2ae6c6d Oct 21, 2024
26 of 27 checks passed
@michelletran-codecov michelletran-codecov deleted the pull_out_more_fixtures branch October 21, 2024 15:28
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.00%. Comparing base (3aca4aa) to head (8d85121).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #797      +/-   ##
==========================================
- Coverage   98.00%   98.00%   -0.01%     
==========================================
  Files         443      443              
  Lines       36566    36532      -34     
==========================================
- Hits        35838    35804      -34     
  Misses        728      728              
Flag Coverage Δ
integration 98.00% <100.00%> (-0.01%) ⬇️
unit 98.00% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.87% <ø> (ø)
OutsideTasks 97.99% <100.00%> (ø)
Files with missing lines Coverage Δ
database/tests/factories/core.py 99.39% <100.00%> (ø)
tasks/tests/unit/test_brolly_stats_rollup.py 96.20% <100.00%> (+0.14%) ⬆️
tasks/tests/unit/test_commit_update.py 100.00% <ø> (ø)
tasks/tests/unit/test_sync_pull.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_upload_task.py 99.09% <ø> (ø)

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