Added support for the multiprocess library in all unittest runners

* Adds the pathos_multiprocess plugin which serves only to
    install the multiprocess package.  If installed, it will
    be used by all unittest runners instead of the default
    multiprocessing library.

Change-Id: Id18ee56d3fb1466f038aaa8c6fd9e2d890847f9e
This commit is contained in:
Jose Idar 2016-04-25 13:47:16 -05:00
parent 0a7a3940e6
commit af88e5129b
3 changed files with 51 additions and 4 deletions

View File

@ -20,7 +20,6 @@ import unittest
import uuid
from importlib import import_module
from inspect import isclass
from multiprocessing import Process, Manager
from re import search
from traceback import print_exc
from cafe.common.reporting import cclogging
@ -31,6 +30,16 @@ from cafe.drivers.unittest.decorators import (
from cafe.drivers.unittest.parsers import SummarizeResults
from cafe.drivers.unittest.suite import OpenCafeUnittestTestSuite
# Support for the alternate dill-based multiprocessing library 'multiprocess'
# as an experimental workaround if you're having pickling errors.
try:
from multiprocess import Process, Manager
sys.stdout.write(
"\n\nUtilizing the pathos multiprocess library. "
"This feature is experimental\n\n")
except:
from multiprocessing import Process, Manager
def tree(directory, padding, print_files=False):
"""

View File

@ -12,18 +12,26 @@
# under the License.
from __future__ import print_function
import sys
# Support for the alternate dill-based multiprocessing library 'multiprocess'
# as an experimental workaround if you're having pickling errors.
try:
from multiprocess import Process, Queue
sys.stdout.write(
"\n\nUtilizing the pathos multiprocess library. "
"This feature is experimental\n\n")
except:
from multiprocessing import Process, Queue
from multiprocessing import Process, Queue
from StringIO import StringIO
from unittest.runner import _WritelnDecorator
import importlib
import logging
import os
import sys
import time
import traceback
import unittest
from cafe.common.reporting import cclogging
from cafe.common.reporting.reporter import Reporter
from cafe.configurator.managers import TestEnvManager

View File

@ -0,0 +1,30 @@
# Copyright 2015 Rackspace
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
This plugin installs the pathos multiprocess package.
Since pathos multiprocess is still in Beta, this plugin is considered
experimental.
If installed, the cafe unittest runners will use multiprocess instead of
python's default multiprocessing library.
"""
from setuptools import setup
setup(
name='cafe_pathos_multiprocess_plugin',
version='0.0.1',
description='The Common Automation Framework Engine',
author='Rackspace Cloud QE',
author_email='cloud-cafe@lists.rackspace.com',
url='http://rackspace.com',
install_requires=['multiprocess'])