def __init__(self, config, archiver=None, encryptor=None, out=None, err=None): """ Constructor. :param config: Config object. :type config: :class:`ConfigParser.RawConfigParser` :param archiver: Name of file archiver. :type archiver: basestring :param encryptor: Name of file encryptor. :type encryptor: basestring :param out: Output stream. :param err: Output stream of error messages. """ self.stream_out = sys.stdout if out is None else out self.stream_err = sys.stderr if err is None else err # Encryptor encryptor_name = None if encryptor is not None: encryptor_name = encryptor elif config.has_option(self.SECTION, 'ENCRYPTOR'): encryptor_name = config.get(self.SECTION, 'ENCRYPTOR') if encryptor_name is not None: self.encryptor = make_encryptor(encryptor_name, config) else: self.encryptor = None # Archiver archiver_name = 'tar' if archiver is not None: archiver_name = archiver elif config.has_option(self.SECTION, 'ARCHIVER'): archiver_name = config.get(self.SECTION, 'ARCHIVER') self.archiver = make_archiver(archiver_name, config, self.encryptor)
def setUpClass(cls): "Setting up class fixture before running tests in the class." cls.config = configparser.RawConfigParser() cls.config.read(os.path.join(TEST_ROOT, 'test.config')) cls.encryptor = make_encryptor('gpg', cls.config)