[pytest-dev] xdist and data sharing during execution in parallel
Ayelet Regev
ayelet at fabrixsystems.com
Wed Sep 17 18:32:20 CEST 2014
Hi,
I'm creating a time-line based on pytest.
im using xdist with multiple slaves (in the amount of the tests). Each
test is started by time and dependency. which mean some of the gateways
will be waiting for others to be "Done".
for that, io need some data sharing between them all, and cannot use
"slaveoutput".
i created my own dict object using file handler, and i want to create
instance once on master and share it will all slaves.
but i cannot pass object to "slaveinput"
Do you have any advice?
*
**def pytest_configure(config):*
config.global_time_line_json = config.getoption("timeline",None)
unicode_to_ascii(config.global_time_line_json)
if config.global_time_line_json is None:
raise Exception("no timeline data was provided to command")
config.properties = config.getoption("properties")
unicode_to_ascii(config.properties)
logfile = config.properties.get("logfile",None)
if logfile is None:
raise Exception("no logfile path was provided to command under
properties")
config.flow_dir = config.properties.get("flow_dir",None)
logfile_basename = os.path.basename(logfile)
_logger = Logger(config.flow_dir,logfile_basename)
config.logger = _logger.logger()
config.active_dir = "%s/%s" % (config.flow_dir,ACTIVE_DIR)
*if not hasattr(config,"slaveinput"):**
** config.logger.info2("Master")**
** config.global_data = PersistentDict('%s/%s' %
(config.active_dir,FLOW_JSON), 'c', format='json')*
*def pytest_configure_node(node):*
# runs only on Master
node.config.logger.info2("on Master sending data to Slave")
*node.slaveinput["global_data"] = node.config.global_data*
--
Best Regards,
Ayelet Regev Dabah
Email: ayelet at fabrixsystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20140917/58f4901f/attachment.html>
More information about the Pytest-dev
mailing list