class TestDB_NEO(TestDB_Base): def __init__(self, dburi): super(TestDB_NEO, self).__init__(dburi) from neo.tests.functional import NEOCluster self.cluster = NEOCluster(["1"], adapter="SQLite") def setup(self): self.cluster.start() self.cluster.expectClusterRunning() def teardown(self): self.cluster.stop() def getZODBStorage(self): return self.cluster.getZODBStorage()
demo_storage = load and not save if activity_node > 1 and demo_storage: sys.exit("--save is required when running several" " zope nodes on an existing NEO database") from neo.lib import logging from neo.tests.functional import NEOCluster logging.backlog() storage_count = 2 if load or save: db_list = [os.path.join(instance_home, 'var', 'neo%u.sqlite' % i) for i in xrange(1, storage_count+1)] else: db_list = [None] * storage_count cwd = os.getcwd() neo_cluster = NEOCluster(db_list, partitions=4, name='erp5/unit_test', temp_dir=cwd, logger=save, adapter='SQLite', clear_databases=not load) forkNodes() if node_pid_list is None: save_mysql = None else: cluster = bool(node_pid_list) sigint = signal.signal(signal.SIGINT, signal.SIG_IGN) try: neo_cluster.start() finally: signal.signal(signal.SIGINT, sigint) Storage = neo_cluster.getZODBStorage(read_only=demo_storage) if demo_storage: Storage = DemoStorage(base=Storage) else:
global node_pid_list for i in xrange(1, activity_node): pid = fork() if not pid: node_pid_list = None os.environ['zserver'] = i < len(zserver_list) and zserver_list[i] or '' break node_pid_list.append(pid) cluster = True if neo_storage: if load or save or zeo_client: raise Exception("--neo_storage conflicts with --load/save/zeo_client") from neo.tests.functional import NEOCluster neo_cluster = NEOCluster(range(2), partitions=4, adapter='BTree', temp_dir=os.getcwd(), verbose=False) sigint = signal.signal(signal.SIGINT, signal.SIG_IGN) neo_cluster.start() signal.signal(signal.SIGINT, sigint) forkNodes() Storage = neo_cluster.getZODBStorage() else: neo_cluster = None while not zeo_client: if activity_node: r, zeo_client = os.pipe() zeo_server_pid = fork() if zeo_server_pid: save_mysql = None os.close(zeo_client) zeo_client = eval(os.fdopen(r).read())
def __init__(self, dburi): super(TestDB_NEO, self).__init__(dburi) from neo.tests.functional import NEOCluster self.cluster = NEOCluster(["1"], adapter="SQLite")