diff --git a/pyproject.toml b/pyproject.toml index 6c3e873..2b3ac1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,13 +22,14 @@ postgres = [ "zope.sqlalchemy", ] app = ["python-dotenv", "zope.publisher", "zope.traversing"] -test = ["pytest"] +test = ["zope.testrunner"] +#test = ["pytest"] [tool.setuptools] packages = ["scopes"] -[tool.pytest.ini_options] -addopts = "-vv" -python_files = "test_standard.py" # default: run only `standard` tests +#[tool.pytest.ini_options] +#addopts = "-vv" +#python_files = "test_standard.py" # default: run only `standard` tests # use .pytest.ini file with `python_files = test_*.py` to run all tests diff --git a/runtests.sh b/runtests.sh index 53e3e91..6e514f2 100755 --- a/runtests.sh +++ b/runtests.sh @@ -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 $@ diff --git a/scopes/tests/__init__.py b/scopes/tests/__init__.py new file mode 100644 index 0000000..7076ddb --- /dev/null +++ b/scopes/tests/__init__.py @@ -0,0 +1 @@ +# py-scopes/tests diff --git a/tests/config.py b/scopes/tests/config.py similarity index 100% rename from tests/config.py rename to scopes/tests/config.py diff --git a/tests/test_postgres.py b/scopes/tests/test_postgres.py similarity index 80% rename from tests/test_postgres.py rename to scopes/tests/test_postgres.py index c4a61e8..f946931 100644 --- a/tests/test_postgres.py +++ b/scopes/tests/test_postgres.py @@ -1,9 +1,12 @@ -#! /usr/bin/python +# scopes.tests.test_postgres """Tests for the 'scopes.storage' package - using PostgreSQL.""" +import os, sys +sys.path = [os.path.dirname(__file__)] + sys.path + import unittest -import tlib_storage +from scopes.tests import tlib_storage from scopes.storage.db.postgres import StorageFactory import config @@ -29,10 +32,10 @@ class Test(unittest.TestCase): def test_004_topic(self): tlib_storage.test_topic(self, config) -def suite(): +def test_suite(): return unittest.TestSuite(( unittest.TestLoader().loadTestsFromTestCase(Test), )) if __name__ == '__main__': - unittest.main(defaultTest='suite') + unittest.main(defaultTest='test_suite') diff --git a/tests/test_standard.py b/scopes/tests/test_standard.py similarity index 85% rename from tests/test_standard.py rename to scopes/tests/test_standard.py index 0dcfcbb..d499b49 100644 --- a/tests/test_standard.py +++ b/scopes/tests/test_standard.py @@ -1,9 +1,12 @@ -#! /usr/bin/python +# scopes.tests.test_standard """Tests for the 'scopes.storage' package.""" +import os, sys +sys.path = [os.path.dirname(__file__)] + sys.path + import unittest -import tlib_server, tlib_storage +from scopes.tests import tlib_server, tlib_storage from scopes.storage.common import StorageFactory import config diff --git a/tests/tlib_server.py b/scopes/tests/tlib_server.py similarity index 100% rename from tests/tlib_server.py rename to scopes/tests/tlib_server.py diff --git a/tests/tlib_storage.py b/scopes/tests/tlib_storage.py similarity index 100% rename from tests/tlib_storage.py rename to scopes/tests/tlib_storage.py