Path: blob/main/singlestoredb/tests/test_plugin.py
801 views
#!/usr/bin/env python1# type: ignore2"""SingleStoreDB Pytest Plugin testing34Each of these tests performs the same simple operation which5would fail if any other test had been run on the same database.6"""7import os89import pytest1011from singlestoredb.connection import Cursor1213# pytest_plugins = ('singlestoredb.pytest',)1415# Skip all tests in this module when using HTTP Data API16# The singlestoredb_tempdb fixture uses 'USE database' which doesn't work with HTTP17pytestmark = pytest.mark.skipif(18'http://' in os.environ.get('SINGLESTOREDB_URL', '').lower() or19'https:/' in os.environ.get('SINGLESTOREDB_URL', '').lower(),20reason='Plugin tests require MySQL protocol (USE database not supported via HTTP)',21)2223CREATE_TABLE_STATEMENT = 'create table test_dict (a text)'242526def test_tempdb1(singlestoredb_tempdb: Cursor):27# alias the fixture28cursor = singlestoredb_tempdb2930cursor.execute(CREATE_TABLE_STATEMENT)313233def test_tempdb2(singlestoredb_tempdb: Cursor):34# alias the fixture35cursor = singlestoredb_tempdb3637cursor.execute(CREATE_TABLE_STATEMENT)383940def test_tempdb3(singlestoredb_tempdb: Cursor):41# alias the fixture42cursor = singlestoredb_tempdb4344cursor.execute(CREATE_TABLE_STATEMENT)454647