Skip to content

Increase TortoiseContext test coverage#2138

Open
seladb wants to merge 3 commits intotortoise:developfrom
seladb:add-context-tests
Open

Increase TortoiseContext test coverage#2138
seladb wants to merge 3 commits intotortoise:developfrom
seladb:add-context-tests

Conversation

@seladb
Copy link
Contributor

@seladb seladb commented Mar 11, 2026

Description

This PR adds comprehensive tests for the TortoiseContext class, covering:

  • set_global_context()
  • init() with config file
  • Router initialization

Motivation and Context

These tests improve code coverage for the TortoiseContext class.

How Has This Been Tested?

All new tests are unit tests using pytest with the @pytest.mark.asyncio decorator where needed. Tests use in-memory SQLite databases and temporary files for config file tests.

Checklist:

  • 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 the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@seladb seladb changed the title Add context tests Increase TortoiseContext test coverage Mar 11, 2026
@seladb seladb marked this pull request as ready for review March 11, 2026 06:57
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 12, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing seladb:add-context-tests (548638a) with develop (5e65d83)

Open in CodSpeed

@seladb
Copy link
Contributor Author

seladb commented Mar 12, 2026

I'm not sure what's the error on sqlite 🤔

https://github.com/tortoise/tortoise-orm/actions/runs/22940646335/job/66743540440?pr=2138

Warning: Failed to download action 'https://api.github.com/repos/astral-sh/setup-uv/tarball/6ee6290f1cbc4156c0bdd66691b2c144ef8df19a'. Error: Response status code does not indicate success: 401 (Unauthorized). 5C00:1EAD18:1950230:6B3F969:69B251E3
Warning: Back off 22.366 seconds before retry.
Warning: Failed to download action 'https://api.github.com/repos/astral-sh/setup-uv/tarball/6ee6290f1cbc4156c0bdd66691b2c144ef8df19a'. Error: Response status code does not indicate success: 401 (Unauthorized). 5C01:16E297:1CD2D72:7A10241:69B251FA
Warning: Back off 10.901 seconds before retry.
Error: Response status code does not indicate success: 401 (Unauthorized).

@coveralls
Copy link

Pull Request Test Coverage Report for Build 22940646335

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 83.611%

Totals Coverage Status
Change from base Build 22825650456: 0.2%
Covered Lines: 11029
Relevant Lines: 12734

💛 - Coveralls

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