summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/pytestplugin.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-07-26 20:50:57 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-07-26 20:50:57 -0400
commitd2358629c9ea7f12718f32b64c7de7f2030dcd32 (patch)
tree1933ad41f00c94c00b9590e72f275e94e04f69ce /lib/sqlalchemy/testing/plugin/pytestplugin.py
parente65cb04974cc35e6f8301b9b7bc2a02d11edf139 (diff)
downloadsqlalchemy-d2358629c9ea7f12718f32b64c7de7f2030dcd32.tar.gz
- scale up for mysql, sqlite
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/pytestplugin.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/pytestplugin.py24
1 files changed, 17 insertions, 7 deletions
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):