You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REFACTOR: Change pytests to use temp tables (starting with #) (#79)
### Summary
This pull request updates the test cases to use temporary tables
(prefixed with `#`) instead of permanent tables for improved isolation
and to prevent unintended side effects during test execution. The
changes span across multiple test functions in the
`tests/test_003_connection.py` and `tests/test_004_cursor.py` files.
### Transition to Temporary Tables
* Updated all test cases in `tests/test_003_connection.py` to use
temporary tables (e.g., `#pytest_test_autocommit`,
`#pytest_test_commit`, `#pytest_test_rollback`) instead of permanent
tables. This includes changes in table creation, data insertion,
selection, and cleanup steps.
[[1]](diffhunk://#diff-ca315ffd463e0f93f3d45ace0869a4a3b1e572941da6723d7e9ce028cf9d2278L80-R114)
[[2]](diffhunk://#diff-ca315ffd463e0f93f3d45ace0869a4a3b1e572941da6723d7e9ce028cf9d2278L126-R168)
* Modified the `TEST_TABLE` definition in `tests/test_004_cursor.py` to
create a temporary table `#pytest_all_data_types` instead of a permanent
one.
* Updated various test cases in `tests/test_004_cursor.py` (e.g.,
`test_insert_id_column`, `test_insert_bit_column`,
`test_insert_nvarchar_column`, `test_insert_date_column`,
`test_insert_real_column`) to use temporary tables
(`#pytest_single_column`) for creating, inserting, and querying data.
This ensures better test isolation and cleanup.
[[1]](diffhunk://#diff-82594712308ff34afa8b067af67db231e9a1372ef474da3db121e14e4d418f69L72-R115)
[[2]](diffhunk://#diff-82594712308ff34afa8b067af67db231e9a1372ef474da3db121e14e4d418f69L190-R217)
### Issue Reference
Fixes
[AB#34163](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/34163)
### Checklist
- [x] **Tests Passed** (if applicable)
- [x] **Code is formatted**
- [x] **Docs Updated** (if necessary)
### Testing Performed
<!-- How was this fix tested? -->
- [x] Unit Tests
0 commit comments