summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/pytestplugin.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-07-25 18:33:04 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-07-25 18:33:04 -0400
commit9e6624c0496e22ec1139e0fb54cfefc14f660352 (patch)
tree673048a2c63d3f59b94fa1326c6b9adfb636bfe1 /lib/sqlalchemy/testing/plugin/pytestplugin.py
parentfe878f5aff1cb17fdf1f13aba1d13f008da0ef4e (diff)
downloadsqlalchemy-9e6624c0496e22ec1139e0fb54cfefc14f660352.tar.gz
- proof of concept for parallel testing
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/pytestplugin.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/pytestplugin.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py
index 11238bbac..7bef644d9 100644
--- a/lib/sqlalchemy/testing/plugin/pytestplugin.py
+++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py
@@ -3,6 +3,7 @@ import argparse
import inspect
from . import plugin_base
import collections
+import itertools
def pytest_addoption(parser):
@@ -24,6 +25,11 @@ def pytest_addoption(parser):
def pytest_configure(config):
+ if hasattr(config, "slaveinput"):
+ plugin_base.configure_follower(
+ config.slaveinput["follower_ident"]
+ )
+
plugin_base.pre_begin(config.option)
plugin_base.set_coverage_flag(bool(getattr(config.option,
@@ -31,6 +37,16 @@ def pytest_configure(config):
plugin_base.post_begin()
+_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"] = next(_follower_count)
+ from . import provision
+ provision.create_follower_db(node.slaveinput["follower_ident"])
+
def pytest_collection_modifyitems(session, config, items):
# look for all those classes that specify __backend__ and