Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
singlestore-labs
GitHub Repository: singlestore-labs/singlestoredb-python
Path: blob/main/singlestoredb/tests/test_plugin.py
800 views
1
#!/usr/bin/env python
2
# type: ignore
3
"""SingleStoreDB Pytest Plugin testing
4
5
Each of these tests performs the same simple operation which
6
would fail if any other test had been run on the same database.
7
"""
8
import os
9
10
import pytest
11
12
from singlestoredb.connection import Cursor
13
14
# pytest_plugins = ('singlestoredb.pytest',)
15
16
# Skip all tests in this module when using HTTP Data API
17
# The singlestoredb_tempdb fixture uses 'USE database' which doesn't work with HTTP
18
pytestmark = pytest.mark.skipif(
19
'http://' in os.environ.get('SINGLESTOREDB_URL', '').lower() or
20
'https:/' in os.environ.get('SINGLESTOREDB_URL', '').lower(),
21
reason='Plugin tests require MySQL protocol (USE database not supported via HTTP)',
22
)
23
24
CREATE_TABLE_STATEMENT = 'create table test_dict (a text)'
25
26
27
def test_tempdb1(singlestoredb_tempdb: Cursor):
28
# alias the fixture
29
cursor = singlestoredb_tempdb
30
31
cursor.execute(CREATE_TABLE_STATEMENT)
32
33
34
def test_tempdb2(singlestoredb_tempdb: Cursor):
35
# alias the fixture
36
cursor = singlestoredb_tempdb
37
38
cursor.execute(CREATE_TABLE_STATEMENT)
39
40
41
def test_tempdb3(singlestoredb_tempdb: Cursor):
42
# alias the fixture
43
cursor = singlestoredb_tempdb
44
45
cursor.execute(CREATE_TABLE_STATEMENT)
46
47