Commit 5f17b308 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[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.
parent 432f87a63057
......@@ -25,8 +25,7 @@ if PY2:
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 @@ from cubicweb.server.checkintegrity import check, check_indexes, reindex_entitie
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 SqliteCheckIndexesTC(CubicWebTC):
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()
......
......@@ -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 @@ class HookCalled(Exception):
pass
config = TestServerConfiguration('data', __file__)
config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
schema = config.load_schema()
......
......@@ -29,11 +29,10 @@ from logilab.common.testlib import TestCase, unittest_main
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 @@ SQL_CONNECT_HOOKS['sqlite'].append(init_sqlite_connexion)
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
......
......@@ -26,7 +26,7 @@ from logilab.common.testlib import TestCase, unittest_main, mock_object
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 monkey_patch_import_driver_module(driver, drivers, quiet=True):
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
......
......@@ -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
......
......@@ -23,7 +23,7 @@ from yams import register_base_type, unregister_base_type
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 @@ def setUpModule(*args):
global schema, config
loader = CubicWebSchemaLoader()
config = TestServerConfiguration('data-schemaserial', __file__)
config = devtools.TestServerConfiguration('data-schemaserial', __file__)
config.bootstrap_cubes()
schema = loader.load(config)
......
......@@ -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 @@ from cubicweb.server.ssplanner import SSPlanner
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()
......
......@@ -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 @@ class Schema(dict):
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):
......
......@@ -24,14 +24,14 @@ from yams import BadSchemaDefinition
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',
......
......@@ -28,13 +28,13 @@ from yams.buildobjs import (RelationDefinition, EntityType, RelationType,
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 @@ class CubicWebSchemaTC(TestCase):
loader = CubicWebSchemaLoader()
config = TestConfiguration('data', __file__)
config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
......@@ -286,7 +286,7 @@ class SchemaReaderClassTest(TestCase):
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()))
......
......@@ -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 @@ class XYTC(TestCase):
@classmethod
def setUpClass(cls):
config = TestServerConfiguration('data', __file__)
config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
cls.schema = config.load_schema()
......
......@@ -20,9 +20,8 @@ from logilab.common.testlib import unittest_main, TestCase
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 @@ WEBVIEWSDIR = join(BASE, 'web', 'views')
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()
......
......@@ -22,7 +22,7 @@ from logilab.common.testlib import TestCase, unittest_main, mock_object as mock
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 @@ from cubicweb.web.views.forms import EntityFieldsForm, FieldsForm
def setUpModule(*args):
global schema
config = TestServerConfiguration('data', __file__)
config = devtools.TestServerConfiguration('data', __file__)
config.bootstrap_cubes()
schema = config.load_schema()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment