-
Notifications
You must be signed in to change notification settings - Fork 10
Pytest rewrite #41
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
base: python314-support
Are you sure you want to change the base?
Pytest rewrite #41
Conversation
- Replace unittest.TestCase with pytest-style test classes - Add conftest.py with fixtures for Tarantool instances and connections - Convert ensure_version from inline function to decorator - Add min_bin_version marker for binary version checks at collection time - Move assertions to tests/utils/assertions.py - Remove _testbase.py (replaced by conftest.py fixtures) - Update all test files to use pytest fixtures and decorators Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- test_connect_wait_tnt_started - test_connect_waiting_for_spaces - test_connect_waiting_for_spaces_no_reconnect - test_connect_waiting_for_spaces_no_reconnect_1_6 - test_connect_err_loading - test_connect_err_loading_1_6 - test_connect_invalid_user_no_reconnect - test_connect_invalid_user_with_reconnect Also add replication_source parameter to create_tarantool_instance() Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add pytest hooks to register and handle the min_bin_version marker: - pytest_configure: registers the marker - pytest_collection_modifyitems: skips tests based on Tarantool binary version - get_tarantool_bin_version: caches the version from a temporary instance Co-Authored-By: Claude Opus 4.5 <[email protected]>
Separates version-checking logic into a reusable check_version function that can be called directly in tests, while ensure_version decorator now delegates to it for cleaner code organization. Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request migrates the test suite from unittest to pytest, a significant refactoring effort that modernizes the testing infrastructure.
Changes:
- Replaced unittest framework with pytest and pytest-asyncio
- Created new
conftest.pywith pytest fixtures for Tarantool instances and connections - Added utility modules for assertions and test parameters
- Migrated all test files to use pytest-style fixtures and assertions
- Updated documentation and project configuration
Reviewed changes
Copilot reviewed 23 out of 25 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/conftest.py | New pytest configuration with fixtures for Tarantool instances, connections, and version checking |
| tests/utils/params.py | Helper functions for generating test parameters |
| tests/utils/assertions.py | Custom assertion helpers replacing unittest assertions |
| tests/test_*.py | All test files migrated from unittest to pytest style |
| tests/init.py | Simplified after removing unittest infrastructure |
| tests/_testbase.py | Deleted old unittest base classes |
| pyproject.toml | Updated pytest configuration and dependencies |
| CLAUDE.md | Updated documentation to reflect pytest usage |
| asynctnt/instance.py | Added missing extra_box_cfg parameter to TarantoolSyncDockerInstance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| import pytest | ||
|
|
||
| import asynctnt |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module 'asynctnt' is imported with both 'import' and 'import from'.
|
|
||
| import pytest | ||
|
|
||
| import asynctnt |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module 'asynctnt' is imported with both 'import' and 'import from'.
|
|
||
| import pytest | ||
|
|
||
| import asynctnt |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module 'asynctnt' is imported with both 'import' and 'import from'.
|
|
||
| import pytest | ||
|
|
||
| import asynctnt |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module 'asynctnt' is imported with both 'import' and 'import from'.
|
|
||
| import pytest | ||
|
|
||
| import asynctnt |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module 'asynctnt' is imported with both 'import' and 'import from'.
| finally: | ||
| try: | ||
| await conn.call("truncate", timeout=5) | ||
| except Exception: |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except Exception: | |
| except Exception: | |
| # Best-effort cleanup: ignore errors during truncate to not mask test result. |
| finally: | ||
| try: | ||
| await conn.call("truncate", timeout=5) | ||
| except Exception: |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except Exception: | |
| except Exception: | |
| # Ignore errors during cleanup: truncate may fail if the helper | |
| # function/space is missing or the connection is already closed. |
| finally: | ||
| try: | ||
| await conn.call("truncate", timeout=5) | ||
| except Exception: |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except Exception: | |
| except Exception: | |
| # Best-effort cleanup: ignore errors during truncate in test teardown. |
| finally: | ||
| try: | ||
| await conn.call("truncate", timeout=5) | ||
| except Exception: |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except Exception: | |
| except Exception: | |
| # Best-effort cleanup: ignore errors during truncate so they don't mask test results. |
Co-authored-by: Copilot <[email protected]>
No description provided.