From d2358629c9ea7f12718f32b64c7de7f2030dcd32 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 26 Jul 2014 20:50:57 -0400 Subject: - scale up for mysql, sqlite --- lib/sqlalchemy/testing/plugin/pytestplugin.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'lib/sqlalchemy/testing/plugin/pytestplugin.py') diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index 7bef644d9..7671c800c 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -5,6 +5,12 @@ from . import plugin_base import collections import itertools +try: + import xdist + has_xdist = True +except ImportError: + has_xdist = False + def pytest_addoption(parser): group = parser.getgroup("sqlalchemy") @@ -37,15 +43,19 @@ def pytest_configure(config): plugin_base.post_begin() -_follower_count = itertools.count(1) +if has_xdist: + _follower_count = itertools.count(1) + def pytest_configure_node(node): + # the master for each node fills slaveinput dictionary + # which pytest-xdist will transfer to the subprocess + node.slaveinput["follower_ident"] = "test_%s" % next(_follower_count) + from . import provision + provision.create_follower_db(node.slaveinput["follower_ident"]) -def pytest_configure_node(node): - # the master for each node fills slaveinput dictionary - # which pytest-xdist will transfer to the subprocess - node.slaveinput["follower_ident"] = next(_follower_count) - from . import provision - provision.create_follower_db(node.slaveinput["follower_ident"]) + def pytest_testnodedown(node, error): + from . import provision + provision.drop_follower_db(node.slaveinput["follower_ident"]) def pytest_collection_modifyitems(session, config, items): -- cgit v1.2.1