28 lines
795 B
Python
28 lines
795 B
Python
"""
|
|
数据库集成测试。
|
|
需要真实数据库连接,默认跳过。
|
|
通过 `--run-integration` 参数运行。
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from paste.db.basetable import BaseTable
|
|
|
|
|
|
@pytest.mark.integration
|
|
class TestDatabaseIntegration:
|
|
"""数据库集成测试"""
|
|
|
|
@pytest.mark.skip(reason="需要真实数据库连接")
|
|
@pytest.mark.asyncio
|
|
async def test_tables_in_db(self):
|
|
"""测试获取数据库表列表"""
|
|
tables = await BaseTable.tables_in_db()
|
|
assert isinstance(tables, list)
|
|
|
|
@pytest.mark.skip(reason="需要真实数据库连接")
|
|
@pytest.mark.asyncio
|
|
async def test_is_table_exist(self):
|
|
"""测试表存在性判断"""
|
|
exists = await BaseTable.is_table_exist('hat_article')
|
|
assert isinstance(exists, bool) |