From 7b230aadf41dd5773af08a21bde60d9c38a9dade Mon Sep 17 00:00:00 2001
From: Carve_ <75568342+Rynzie02@users.noreply.github.com>
Date: Tue, 3 Feb 2026 17:28:53 +0800
Subject: [PATCH] chore(tests): move oceanbase peewee test under test/ and fix
enum check (#12969)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
### What problem does this PR solve?
This mistake was made by PR #12926
This PR makes the OceanBase peewee unit test discoverable by the default
unit test runner/CI (by moving it under test/), so it’s included in the
unified unit test suite.
It also fixes `test_database_lock_enum_values` to correctly handle Enum
alias members (DatabaseLock uses the same value for MYSQL and
OCEANBASE).
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
### Screenshots
The original `test_oceanbase_peewee.py` was placed under tests/, which
isn’t included in the default unit test runner’s testpaths, so it wasn’t
picked up by the unit test suite. So we need to move it to correct path.
When using old version in `test_oceanbase_peewee.py`:
```
def test_database_lock_enum_values(self):
"""Test DatabaseLock enum has all expected values."""
expected = {'MYSQL', 'OCEANBASE', 'POSTGRES'}
actual = {e.name for e in DatabaseLock}
assert expected.issubset(actual), f"Missing: {expected - actual}"
```
The old check iterated Enum members, so alias values were skipped and
only `MYSQL/POSTGRES` were seen, making OCEANBASE appear missing.
and new version uses `DatabaseLock.__members__` and passes:
---
{tests/unit => test/unit_test/utils}/test_oceanbase_peewee.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename {tests/unit => test/unit_test/utils}/test_oceanbase_peewee.py (98%)
diff --git a/tests/unit/test_oceanbase_peewee.py b/test/unit_test/utils/test_oceanbase_peewee.py
similarity index 98%
rename from tests/unit/test_oceanbase_peewee.py
rename to test/unit_test/utils/test_oceanbase_peewee.py
index 7ff0ef2d2..6ddee9850 100644
--- a/tests/unit/test_oceanbase_peewee.py
+++ b/test/unit_test/utils/test_oceanbase_peewee.py
@@ -71,7 +71,7 @@ class TestOceanBaseDatabase:
def test_database_lock_enum_values(self):
"""Test DatabaseLock enum has all expected values."""
expected = {'MYSQL', 'OCEANBASE', 'POSTGRES'}
- actual = {e.name for e in DatabaseLock}
+ actual = set(DatabaseLock.__members__.keys())
assert expected.issubset(actual), f"Missing: {expected - actual}"