I would just use something like redis for that, seriously Don't overcomplicate things in pytest-xdist As a side note, if you need the communication between the tests, then you're probably doing something wrong, as it's the rule of thumb - tests cannot share state with other tests
On 17 September 2014 18:32, Ayelet Regev <[email protected]> wrote: > 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: [email protected] > > > _______________________________________________ > Pytest-dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/pytest-dev > > -- Anatoly Bubenkov
_______________________________________________ Pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
