Package: zeo_connector_defaults
IntroductionDefault configuration files and configuration file generator forzeo_connector.DocumentationThis project provides generators of the testing environment for the ZEO-related tests. It also provides generator, for the basic ZEO configuration files.zeo_connector_gen_defaults.pyThis script simplifies the process of generation of ZEO configuration files.ZEO testsTypically, when you test your program which is using the ZEO database, you need to generate the database files, then run new thread withrunzeoprogram, do tests, cleanup and stop the thread.This module provides two functions, which do exactly this:zeo_connector_defaults.generate_environment()zeo_connector_defaults.cleanup_environment()generate_environmentThis function will create temporary directory in/tmpand copy template files for ZEO client and server into this directory. Then it starts new thread withrunzeoprogram using the temporary server configuration file.Names of the files may be resolved usingtmp_context_name()function.Note:This function works best, if added to setup part of your test environment.cleanup_environmentFunction, which stops the runningrunzeothread and delete all the temporary files.Note:This function works best, if added to setup part of your test environment.Context functionsThere is also twotemp environment access functions:tmp_context_name()tmp_context()Both of them take onefnargument and return name of the file (tmp_context_name()) or content of the file (tmp_context()) in context of random temporary directory.For example:tmp_context_name("zeo_client.conf")returns the absolute path to the filezeo_client.conf, which may be for example/tmp/tmp1r5keh/zeo_client.conf.You may also call it without the arguments, which will return just the name of the temporary directory:tmp_context_name()which should return something like/tmp/tmp1r5keh.Tests exampleHere is the example how your test may look like:#! /usr/bin/env python# -*- coding: utf-8 -*-## Interpreter version: python 2.7## Imports =====================================================================importpytestfromzeo_connector_defaultsimportgenerate_environmentfromzeo_connector_defaultsimportcleanup_environmentfromzeo_connector_defaultsimporttmp_context_name# Setup =======================================================================defsetup_module(module):generate_environment()defteardown_module(module):cleanup_environment()# Fixtures ====================================================================@pytest.fixturedefzeo_conf_wrapper():returnZEOConfWrapper(conf_path=tmp_context_name("zeo_client.conf"),...# Tests =======================================================================deftest_something(zeo_conf_wrapper):...InstallationModule ishosted at PYPI, and can be easily installed usingPIP:sudo pip install zeo_connector_defaultsSource codeProject is released under the MIT license. Source code can be found at GitHub:https://github.com/Bystroushaak/zeo_connector_defaultsChangelog0.2.2Small bugfix.Removed unused files.0.2.1Switched to complete randomly generated ZEO environment (random name in /tmp, and random ports for ZEO server process).0.2.0Bugfix of path parsing.0.1.0Project created.