<commit_before>#!/usr/bin/env python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
#


def pytest_addoption(parser):
    parser.addoption(
        "--delete_indexes",
        action='store_true',
        default=False,
        help="A flag to indicate if we should delete all indexes in ES before each test. This could result in inconsistent tests if not specified."
    )
    parser.addoption(
        "--delete_queues",
        action='store_true',
        default=False,
        help="A flag to indicate if we should delete the contents of rabbitmq queues. This could result in inconsistent tests if not specified."
    )


def pytest_configure(config):
    warning_text = ""
    if not config.option.delete_indexes:
        warning_text += "\n** WARNING - Some unit tests will not pass unless the --delete_indexes is specified."
        warning_text += "\nThis is due to the fact that some tests need a 'clean' ES environment **\n"
        warning_text += "** DISCLAIMER - If you enable this flag, all indexes that MozDef uses will be deleted upon test execution **\n"
    else:
        warning_text += "\n** WARNING - The --delete_indexes flag has been set. We will be deleting important indexes from ES before test execution**\n"
        warning_text += "Continuing the unit test execution in 10 seconds...CANCEL ME IF YOU DO NOT WANT PREVIOUS INDEXES DELETED!!! **\n"

    if not config.option.delete_queues:<commit_msg>Fix breaking tests<commit_after>#!/usr/bin/env python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation

import time


def pytest_addoption(parser):
    parser.addoption(
        "--delete_indexes",
        action='store_true',
        default=False,
        help="A flag to indicate if we should delete all indexes in ES before each test. This could result in inconsistent tests if not specified."
    )
    parser.addoption(
        "--delete_queues",
        action='store_true',
        default=False,
        help="A flag to indicate if we should delete the contents of rabbitmq queues. This could result in inconsistent tests if not specified."
    )


def pytest_configure(config):
    warning_text = ""
    if not config.option.delete_indexes:
        warning_text += "\n** WARNING - Some unit tests will not pass unless the --delete_indexes is specified."
        warning_text += "\nThis is due to the fact that some tests need a 'clean' ES environment **\n"
        warning_text += "** DISCLAIMER - If you enable this flag, all indexes that MozDef uses will be deleted upon test execution **\n"
    else:
        warning_text += "\n** WARNING - The --delete_indexes flag has been set. We will be deleting important indexes from ES before test execution**\n"
        warning_text += "Continuing the unit test execution in 10 seconds...CANCEL ME IF YOU DO NOT WANT PREVIOUS INDEXES DELETED!!! **\n"

    if not config.option.delete_queues:
{'fraction_non_alphanumeric': 0.08680981595092024, 'fraction_numerical': 0.006134969325153374, 'mean_word_length': 3.04089219330855, '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': '1022755', 'n_tokens_mistral': 931, 'n_tokens_neox': 876, 'n_words': 393}