move tests into scopes package, provide runtests.sh calling zope-testrunner

This commit is contained in:
Helmut Merz 2024-09-30 09:50:58 +02:00
parent c9cb428707
commit ab050ba360
8 changed files with 22 additions and 12 deletions

View file

@ -22,13 +22,14 @@ postgres = [
"zope.sqlalchemy", "zope.sqlalchemy",
] ]
app = ["python-dotenv", "zope.publisher", "zope.traversing"] app = ["python-dotenv", "zope.publisher", "zope.traversing"]
test = ["pytest"] test = ["zope.testrunner"]
#test = ["pytest"]
[tool.setuptools] [tool.setuptools]
packages = ["scopes"] packages = ["scopes"]
[tool.pytest.ini_options] #[tool.pytest.ini_options]
addopts = "-vv" #addopts = "-vv"
python_files = "test_standard.py" # default: run only `standard` tests #python_files = "test_standard.py" # default: run only `standard` tests
# use .pytest.ini file with `python_files = test_*.py` to run all tests # use .pytest.ini file with `python_files = test_*.py` to run all tests

View file

@ -1,3 +1,5 @@
# runtests.sh
# run all unit / doc tests
zope-testrunner --test-path=. $*
python tests/test_postgres.py $@
python tests/test_standard.py $@

1
scopes/tests/__init__.py Normal file
View file

@ -0,0 +1 @@
# py-scopes/tests

View file

@ -1,9 +1,12 @@
#! /usr/bin/python # scopes.tests.test_postgres
"""Tests for the 'scopes.storage' package - using PostgreSQL.""" """Tests for the 'scopes.storage' package - using PostgreSQL."""
import os, sys
sys.path = [os.path.dirname(__file__)] + sys.path
import unittest import unittest
import tlib_storage from scopes.tests import tlib_storage
from scopes.storage.db.postgres import StorageFactory from scopes.storage.db.postgres import StorageFactory
import config import config
@ -29,10 +32,10 @@ class Test(unittest.TestCase):
def test_004_topic(self): def test_004_topic(self):
tlib_storage.test_topic(self, config) tlib_storage.test_topic(self, config)
def suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
unittest.TestLoader().loadTestsFromTestCase(Test), unittest.TestLoader().loadTestsFromTestCase(Test),
)) ))
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(defaultTest='suite') unittest.main(defaultTest='test_suite')

View file

@ -1,9 +1,12 @@
#! /usr/bin/python # scopes.tests.test_standard
"""Tests for the 'scopes.storage' package.""" """Tests for the 'scopes.storage' package."""
import os, sys
sys.path = [os.path.dirname(__file__)] + sys.path
import unittest import unittest
import tlib_server, tlib_storage from scopes.tests import tlib_server, tlib_storage
from scopes.storage.common import StorageFactory from scopes.storage.common import StorageFactory
import config import config