<commit_before>"""Local pytest plugin."""


import pytest
from pytest import symbols

import systest_common.src as common

from . import utils


@pytest.fixture(scope='module', autouse=True)
def marathon(request):
    """Provide a marathon connection."""
    return common.marathon.connect(symbols.marathon_url)


@pytest.fixture(scope='module', autouse=True)
def ssh(request):
    """Provide an ssh connection - via the bastion host."""
    return common.ssh.connect(gateway=symbols.bastion)


@pytest.fixture(scope='module', autouse=True)
def bigip(request):
    """Provide a bigip connection."""
    return common.bigip.connect(
        symbols.bigip_default_ip,
        utils.DEFAULT_BIGIP_USERNAME,
        utils.DEFAULT_BIGIP_PASSWORD
    )


@pytest.fixture(scope='function', autouse=True)
def default_test_fx(request, marathon, bigip):
    """Default test fixture.

    Create a test partition on test setup.
    Delete all marathon apps on test teardown.
    Delete test partition on test teardown.
    """
    partition = utils.DEFAULT_F5MLB_PARTITION
    bigip.partition.create(partition, subPath="/")

    def teardown():
        marathon.apps.delete()
        marathon.deployments.delete()
        bigip.virtual_servers.delete(partition=partition)
        bigip.virtual_addresses.delete(partition=partition)
        bigip.pools.delete(partition=partition)
        bigip.nodes.delete(partition=partition)
        bigip.health_monitors.delete(partition=partition)
        bigip.partition.delete(name=partition)

    request.addfinalizer(teardown)


@pytest.fixture(scope='function')
def f5mlb(request, marathon):
    """Provide a default f5mlb app."""
    f5mlb = utils.create_f5mlb(marathon)

    def teardown():
        f5mlb.delete()

    request.addfinalizer(teardown)
    return f5mlb<commit_msg>Add support for skipping the test/suite teardown steps.<commit_after>"""Local pytest plugin."""


import pytest
from pytest import symbols

import systest_common.src as common

from . import utils


@pytest.fixture(scope='module', autouse=True)
def marathon(request):
    """Provide a marathon connection."""
    return common.marathon.connect(symbols.marathon_url)


@pytest.fixture(scope='module', autouse=True)
def ssh(request):
    """Provide an ssh connection - via the bastion host."""
    return common.ssh.connect(gateway=symbols.bastion)


@pytest.fixture(scope='module', autouse=True)
def bigip(request):
    """Provide a bigip connection."""
    return common.bigip.connect(
        symbols.bigip_default_ip,
        utils.DEFAULT_BIGIP_USERNAME,
        utils.DEFAULT_BIGIP_PASSWORD
    )


@pytest.fixture(scope='function', autouse=True)
def default_test_fx(request, marathon, bigip):
    """Default test fixture.

    Create a test partition on test setup.
    Delete all marathon apps on test teardown.
    Delete test partition on test teardown.
    """
    partition = utils.DEFAULT_F5MLB_PARTITION
    bigip.partition.create(partition, subPath="/")

    def teardown():
        if request.config._meta.vars.get('skip_teardown', None):
            return
        marathon.apps.delete()
        marathon.deployments.delete()
        bigip.virtual_servers.delete(partition=partition)
        bigip.virtual_addresses.delete(partition=partition)
        bigip.pools.delete(partition=partition)
        bigip.nodes.delete(partition=partition)
        bigip.health_monitors.delete(partition=partition)
        bigip.partition.delete(name=partition)

    request.addfinalizer(teardown)


@pytest.fixture(scope='function')
def f5mlb(request, marathon):
    """Provide a default f5mlb app."""
    f5mlb = utils.create_f5mlb(marathon)

    def teardown():
        if request.config._meta.vars.get('skip_teardown', None):
            return
        f5mlb.delete()

    request.addfinalizer(teardown)
    return f5mlb
{'fraction_non_alphanumeric': 0.11006781429316641, 'fraction_numerical': 0.0036515388628064684, 'mean_word_length': 3.7580645161290325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4039170', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1197, 'n_words': 242}