move common test stuff to testing package

This commit is contained in:
Helmut Merz 2026-10-05 14:54:04 +02:00
parent 5f9d8a73d2
commit 1bc2583de8
4 changed files with 31 additions and 13 deletions

View file

@ -1,4 +1,4 @@
# scopes.api.core.message # scopes.api.message
"""routes and views for Message objects""" """routes and views for Message objects"""

17
scopes/testing.py Normal file
View file

@ -0,0 +1,17 @@
# scopes.testing
"""Common stuff (config, fixtures, ...) for testing"""
import os, sys
sys.path = [os.path.dirname(__file__)] + sys.path
import config
from scopes.storage.db import postgres
config.dbengine = 'postgresql+psycopg'
config.dbname = 'testdb'
config.dbuser = 'testuser'
config.dbpassword = 'secret'
config.dbschema = 'testing'
config.StorageFactory = postgres.StorageFactory

View file

@ -1,22 +1,15 @@
# scopes.tests.test_api # py-scopes: tests.test_api
"""Tests for the fastapi- (and asyncio-) based stuff.""" """Tests for the fastapi- (and asyncio-) based stuff"""
from scopes import testing
import os, sys import os, sys
sys.path = [os.path.dirname(__file__)] + sys.path
import config import config
from scopes.storage.db import postgres from scopes.storage import tracking
from scopes.storage import concept, folder, message, topic, tracking
import transaction import transaction
config.dbengine = 'postgresql+psycopg'
config.dbname = 'testdb'
config.dbuser = 'testuser'
config.dbpassword = 'secret'
config.dbschema = 'testing'
config.StorageFactory = postgres.StorageFactory
import pytest import pytest
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
from httpx2 import ASGITransport, AsyncClient from httpx2 import ASGITransport, AsyncClient

8
tests/test_message.py Normal file
View file

@ -0,0 +1,8 @@
# py-scopes: tests.test_message
"""Tests for messages and related stuff"""
import pytest
from scopes.core.message import Message