Ejemplo n.º 1
0
 def tearDown(self):
     if len(self.working_dir) < 3:
         print(
             'ERROR: working directory less than 3 chars long, unable to clean up: %s'
             % str(self.working_dir))
         return
     shutil.rmtree(self.working_dir)
     SparcZCMLFileLayer.tearDown(self)
Ejemplo n.º 2
0
from .mellon import create_and_register_app
import mellon
from .interfaces import IPath
from sparc.testing.testlayer import SparcZCMLFileLayer
from zope import component
from zope.component.testlayer import LayerBase
from zope import interface
import shutil
import tempfile

MELLON_INTEGRATION_LAYER = SparcZCMLFileLayer(mellon)


class MellonRuntimeLayerMixin(LayerBase):
    """
    Provides base components to enable installation of a Mellon runtime
    environment.
    """

    config = {
        'MellonSnippet': {
            'lines_coverage': 2,
            'lines_increment': 1,
            'bytes_read_size': 8,
            'bytes_coverage': 4,
            'bytes_increment': 3
        },
        'ZCMLConfiguration': [{
            'package': 'mellon.reporters.memory'
        }, {
            'package': 'mellon',
Ejemplo n.º 3
0
import sparc.proxy
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_PROXY_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.proxy)
Ejemplo n.º 4
0
import sparc.component
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_COMPONENT_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.component)
Ejemplo n.º 5
0
import sparc.tail
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_TAIL_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.tail)
Ejemplo n.º 6
0
import sparc.filter
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_FILTER_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.filter)
Ejemplo n.º 7
0
import sparc.cli
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_CLI_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.cli)
Ejemplo n.º 8
0
import sparc.requests
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_REQUESTS_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.requests)
Ejemplo n.º 9
0
import sparc.git
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_GIT_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.git)
Ejemplo n.º 10
0
import sparc.config
from sparc.testing.testlayer import SparcZCMLFileLayer

SPARC_CONFIG_INTEGRATION_LAYER = SparcZCMLFileLayer(sparc.config)
Ejemplo n.º 11
0
    def setUp(self):
        SparcZCMLFileLayer.setUp(self)
        """
        1
         /a
           exact.txt
           exact.bin
         /b
           [empty]
         largest.txt
         largest.bin
        2
         /c
           [empty]
         /d
           larger.txt
           larger.bin
        small.txt
        small.bin
        
        *-small => smaller than coverage
        *-exact => exact size as coverage
        *-larger => a little larger than coverage
        *-largest => much larger than coverage
        """
        self.working_dir = tempfile.mkdtemp()
        os.makedirs(os.path.join(self.working_dir, '1', 'a'))
        os.makedirs(os.path.join(self.working_dir, '1', 'b'))
        os.makedirs(os.path.join(self.working_dir, '2', 'c'))
        os.makedirs(os.path.join(self.working_dir, '2', 'd'))

        self.create_file(['small.txt'], 'text', 4)
        self.create_file(['small.bin'], 'binary', 128)

        self.create_file(['1', 'largest.txt'], 'text', 1024)
        self.create_file(['1', 'largest.bin'], 'binary', 2 *
                         DEFAULT_read_size * DEFAULT_snippet_bytes_coverage)

        self.create_file(['1', 'a', 'exact.txt'], 'text', 5)
        self.create_file(['1', 'a', 'exact.bin'], 'binary',
                         DEFAULT_read_size * DEFAULT_snippet_bytes_coverage)

        self.create_file(['2', 'd', 'larger.txt'], 'text', 8)
        self.create_file(['2', 'd', 'larger.bin'], 'binary',
                         DEFAULT_read_size * DEFAULT_snippet_bytes_coverage +
                         DEFAULT_read_size)

        config = {
            'MellonSnippet': {
                'lines_increment': DEFAULT_snippet_lines_increment,
                'lines_coverage': DEFAULT_snippet_lines_coverage,
                'bytes_read_size': DEFAULT_read_size,
                'bytes_increment': DEFAULT_snippet_bytes_increment,
                'bytes_coverage': DEFAULT_snippet_bytes_coverage
            },
            'FileSystemDir': {
                'directory': self.working_dir
            }
        }
        self.config = component.createObject(u'sparc.configuration.container',
                                             config)