From 1bc2583de81689dae17838b59834db43c352ac67 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Mon, 5 Oct 2026 14:54:04 +0200 Subject: [PATCH] move common test stuff to testing package --- scopes/api/{core => }/message.py | 2 +- scopes/testing.py | 17 +++++++++++++++++ tests/test_api.py | 17 +++++------------ tests/test_message.py | 8 ++++++++ 4 files changed, 31 insertions(+), 13 deletions(-) rename scopes/api/{core => }/message.py (63%) create mode 100644 scopes/testing.py create mode 100644 tests/test_message.py diff --git a/scopes/api/core/message.py b/scopes/api/message.py similarity index 63% rename from scopes/api/core/message.py rename to scopes/api/message.py index bb75762..ea6a3c4 100644 --- a/scopes/api/core/message.py +++ b/scopes/api/message.py @@ -1,4 +1,4 @@ -# scopes.api.core.message +# scopes.api.message """routes and views for Message objects""" diff --git a/scopes/testing.py b/scopes/testing.py new file mode 100644 index 0000000..1bbe686 --- /dev/null +++ b/scopes/testing.py @@ -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 + + diff --git a/tests/test_api.py b/tests/test_api.py index b65e28c..619ef28 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -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 -sys.path = [os.path.dirname(__file__)] + sys.path import config -from scopes.storage.db import postgres -from scopes.storage import concept, folder, message, topic, tracking +from scopes.storage import tracking import transaction -config.dbengine = 'postgresql+psycopg' -config.dbname = 'testdb' -config.dbuser = 'testuser' -config.dbpassword = 'secret' -config.dbschema = 'testing' -config.StorageFactory = postgres.StorageFactory - import pytest from fastapi.testclient import TestClient from httpx2 import ASGITransport, AsyncClient diff --git a/tests/test_message.py b/tests/test_message.py new file mode 100644 index 0000000..21cc86f --- /dev/null +++ b/tests/test_message.py @@ -0,0 +1,8 @@ +# py-scopes: tests.test_message + +"""Tests for messages and related stuff""" + +import pytest + +from scopes.core.message import Message +