[test] Avoid pytest discovery warnings
Having TestServerConfiguration and alike in the test module namespace causes
pytest discovery errors, because it thinks it's a test class.
--- a/cubicweb/server/test/unittest_checkintegrity.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/server/test/unittest_checkintegrity.py Thu Oct 06 21:14:49 2016 +0200
@@ -25,8 +25,7 @@
else:
from io import StringIO
-from cubicweb.devtools import (PostgresApptestConfiguration, TestServerConfiguration,
- get_test_db_handler, startpgcluster, stoppgcluster)
+from cubicweb import devtools
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.server.checkintegrity import check, check_indexes, reindex_entities
@@ -34,7 +33,7 @@
class CheckIntegrityTC(unittest.TestCase):
def setUp(self):
- handler = get_test_db_handler(TestServerConfiguration('data', __file__))
+ handler = devtools.get_test_db_handler(devtools.TestServerConfiguration('data', __file__))
handler.build_db_cache()
self.repo, _cnx = handler.get_repo_and_cnx()
sys.stderr = sys.stdout = StringIO()
@@ -81,16 +80,16 @@
class PGCheckIndexesTC(SqliteCheckIndexesTC):
- configcls = PostgresApptestConfiguration
+ configcls = devtools.PostgresApptestConfiguration
@classmethod
def setUpClass(cls):
- startpgcluster(__file__)
+ devtools.startpgcluster(__file__)
super(PGCheckIndexesTC, cls).setUpClass()
@classmethod
def tearDownClass(cls):
- stoppgcluster(__file__)
+ devtools.stoppgcluster(__file__)
super(PGCheckIndexesTC, cls).tearDownClass()
--- a/cubicweb/server/test/unittest_hook.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/server/test/unittest_hook.py Thu Oct 06 21:14:49 2016 +0200
@@ -20,7 +20,8 @@
from logilab.common.testlib import TestCase, unittest_main, mock_object
-from cubicweb.devtools import TestServerConfiguration, fake
+from cubicweb import devtools
+from cubicweb.devtools import fake
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.server import hook
from cubicweb.hooks import integrity, syncschema
@@ -61,7 +62,7 @@
pass
-config = TestServerConfiguration('data', __file__)
+config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
schema = config.load_schema()
--- a/cubicweb/server/test/unittest_querier.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/server/test/unittest_querier.py Thu Oct 06 21:14:49 2016 +0200
@@ -29,11 +29,10 @@
from rql import BadRQLQuery
from rql.utils import register_function, FunctionDescr
-from cubicweb import QueryError, Unauthorized, Binary
+from cubicweb import QueryError, Unauthorized, Binary, devtools
from cubicweb.server.sqlutils import SQL_CONNECT_HOOKS, SQL_PREFIX
from cubicweb.server.utils import crypt_password
from cubicweb.server.querier import manual_build_descr, _make_description
-from cubicweb.devtools import get_test_db_handler, TestServerConfiguration
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.devtools.repotest import tuplify, BaseQuerierTC
@@ -73,8 +72,8 @@
def setUpClass(cls, *args):
global repo, cnx
- config = TestServerConfiguration('data', __file__)
- handler = get_test_db_handler(config)
+ config = devtools.TestServerConfiguration('data', __file__)
+ handler = devtools.get_test_db_handler(config)
handler.build_db_cache()
repo, cnx = handler.get_repo_and_cnx()
cls.repo = repo
--- a/cubicweb/server/test/unittest_rql2sql.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/server/test/unittest_rql2sql.py Thu Oct 06 21:14:49 2016 +0200
@@ -26,7 +26,7 @@
from rql import BadRQLQuery
from rql.utils import register_function, FunctionDescr
-from cubicweb.devtools import TestServerConfiguration
+from cubicweb import devtools
from cubicweb.devtools.repotest import RQLGeneratorTC
from cubicweb.server.sources.rql2sql import remove_unused_solutions
@@ -61,7 +61,7 @@
def setUpModule():
global config, schema
- config = TestServerConfiguration('data', __file__)
+ config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
schema = config.load_schema()
schema['in_state'].inlined = True
--- a/cubicweb/server/test/unittest_rqlannotation.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/server/test/unittest_rqlannotation.py Thu Oct 06 21:14:49 2016 +0200
@@ -18,14 +18,14 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""unit tests for modules cubicweb.server.rqlannotation"""
-from cubicweb.devtools import TestServerConfiguration, get_test_db_handler
+from cubicweb import devtools
from cubicweb.devtools.repotest import BaseQuerierTC
class SQLGenAnnotatorTC(BaseQuerierTC):
def setUp(self):
- handler = get_test_db_handler(TestServerConfiguration('data', __file__))
+ handler = devtools.get_test_db_handler(devtools.TestServerConfiguration('data', __file__))
handler.build_db_cache()
repo, _cnx = handler.get_repo_and_cnx()
self.__class__.repo = repo
--- a/cubicweb/server/test/unittest_schemaserial.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/server/test/unittest_schemaserial.py Thu Oct 06 21:14:49 2016 +0200
@@ -23,7 +23,7 @@
from cubicweb import Binary
from cubicweb.schema import CubicWebSchemaLoader
-from cubicweb.devtools import TestServerConfiguration
+from cubicweb import devtools
from cubicweb.devtools.testlib import BaseTestCase as TestCase, CubicWebTC
from cubicweb.server.schemaserial import (updateeschema2rql, updaterschema2rql, rschema2rql,
eschema2rql, rdef2rql, specialize2rql,
@@ -40,7 +40,7 @@
global schema, config
loader = CubicWebSchemaLoader()
- config = TestServerConfiguration('data-schemaserial', __file__)
+ config = devtools.TestServerConfiguration('data-schemaserial', __file__)
config.bootstrap_cubes()
schema = loader.load(config)
--- a/cubicweb/server/test/unittest_ssplanner.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/server/test/unittest_ssplanner.py Thu Oct 06 21:14:49 2016 +0200
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-from cubicweb.devtools import TestServerConfiguration, get_test_db_handler
+from cubicweb import devtools
from cubicweb.devtools.repotest import BasePlannerTC, check_plan
from cubicweb.server.ssplanner import SSPlanner
@@ -24,7 +24,7 @@
def setUpModule(*args):
# keep cnx so it's not garbage collected and the associated session closed
global repo, cnx
- handler = get_test_db_handler(TestServerConfiguration('data', __file__))
+ handler = devtools.get_test_db_handler(devtools.TestServerConfiguration('data', __file__))
handler.build_db_cache()
global repo, cnx
repo, cnx = handler.get_repo_and_cnx()
--- a/cubicweb/test/unittest_migration.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/test/unittest_migration.py Thu Oct 06 21:14:49 2016 +0200
@@ -20,7 +20,7 @@
from os.path import dirname, join
from logilab.common.testlib import TestCase, unittest_main
-from cubicweb.devtools import TestServerConfiguration
+from cubicweb import devtools
from cubicweb.cwconfig import CubicWebConfiguration
from cubicweb.migration import filter_scripts, version_strictly_lower
@@ -32,7 +32,8 @@
SMIGRDIR = join(dirname(__file__), 'data', 'server_migration') + '/'
TMIGRDIR = join(dirname(__file__), 'data', 'migration') + '/'
-class MigrTestConfig(TestServerConfiguration):
+
+class MigrTestConfig(devtools.TestServerConfiguration):
verbosity = 0
def migration_scripts_dir(cls):
--- a/cubicweb/test/unittest_rqlrewrite.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/test/unittest_rqlrewrite.py Thu Oct 06 21:14:49 2016 +0200
@@ -24,14 +24,14 @@
from yams.buildobjs import RelationDefinition
from rql import parse, nodes, RQLHelper
-from cubicweb import Unauthorized, rqlrewrite
+from cubicweb import Unauthorized, rqlrewrite, devtools
from cubicweb.schema import RRQLExpression, ERQLExpression
-from cubicweb.devtools import repotest, TestServerConfiguration, BaseApptestConfiguration
+from cubicweb.devtools import repotest
def setUpModule(*args):
global rqlhelper, schema
- config = TestServerConfiguration('data-rewrite', __file__)
+ config = devtools.TestServerConfiguration('data-rewrite', __file__)
config.bootstrap_cubes()
schema = config.load_schema()
schema.add_relation_def(RelationDefinition(subject='Card', name='in_state',
--- a/cubicweb/test/unittest_schema.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/test/unittest_schema.py Thu Oct 06 21:14:49 2016 +0200
@@ -28,13 +28,13 @@
Int, String, ComputedRelation)
from yams.reader import fill_schema
+from cubicweb import devtools
from cubicweb.schema import (
CubicWebSchema, CubicWebSchemaLoader,
RQLConstraint, RQLUniqueConstraint, RQLVocabularyConstraint,
ERQLExpression, RRQLExpression,
normalize_expression, order_eschemas, guess_rrqlexpr_mainvars,
build_schema_from_namespace)
-from cubicweb.devtools import TestServerConfiguration as TestConfiguration
from cubicweb.devtools.testlib import CubicWebTC
DATADIR = join(dirname(__file__), 'data')
@@ -150,7 +150,7 @@
loader = CubicWebSchemaLoader()
-config = TestConfiguration('data', __file__)
+config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
@@ -286,7 +286,7 @@
def test_relation_perm_overriding(self):
loader = CubicWebSchemaLoader()
- config = TestConfiguration('data_schemareader', __file__)
+ config = devtools.TestServerConfiguration('data_schemareader', __file__)
config.bootstrap_cubes()
schema = loader.load(config)
rdef = next(iter(schema['in_group'].rdefs.values()))
--- a/cubicweb/test/unittest_spa2rql.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/test/unittest_spa2rql.py Thu Oct 06 21:14:49 2016 +0200
@@ -17,8 +17,7 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
import unittest
-from logilab.common.testlib import TestCase, unittest_main
-from cubicweb.devtools import TestServerConfiguration
+from cubicweb import devtools
from cubicweb.xy import xy
SKIPCAUSE = None
@@ -40,7 +39,7 @@
@classmethod
def setUpClass(cls):
- config = TestServerConfiguration('data', __file__)
+ config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
cls.schema = config.load_schema()
--- a/cubicweb/test/unittest_vregistry.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/test/unittest_vregistry.py Thu Oct 06 21:14:49 2016 +0200
@@ -20,9 +20,8 @@
from os.path import join
-from cubicweb import CW_SOFTWARE_ROOT as BASE
+from cubicweb import CW_SOFTWARE_ROOT as BASE, devtools
from cubicweb.cwvreg import CWRegistryStore, UnknownProperty
-from cubicweb.devtools import TestServerConfiguration
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.view import EntityAdapter
@@ -37,7 +36,7 @@
class VRegistryTC(TestCase):
def setUp(self):
- config = TestServerConfiguration('data', __file__)
+ config = devtools.TestServerConfiguration('data', __file__)
self.vreg = CWRegistryStore(config)
config.bootstrap_cubes()
self.vreg.schema = config.load_schema()
--- a/cubicweb/web/test/unittest_formfields.py Fri Sep 30 18:25:08 2016 +0200
+++ b/cubicweb/web/test/unittest_formfields.py Thu Oct 06 21:14:49 2016 +0200
@@ -22,7 +22,7 @@
from yams.constraints import StaticVocabularyConstraint, SizeConstraint
import cubicweb
-from cubicweb.devtools import TestServerConfiguration
+from cubicweb import devtools
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.web.formwidgets import PasswordInput, Select, Radio
from cubicweb.web.formfields import *
@@ -31,7 +31,7 @@
def setUpModule(*args):
global schema
- config = TestServerConfiguration('data', __file__)
+ config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
schema = config.load_schema()