<commit_before>import os
import pytest
import s3_integration_help
import sys

from wal_e import cmd

_PREFIX_VARS = ['WALE_S3_PREFIX', 'WALE_WABS_PREFIX', 'WALE_SWIFT_PREFIX']


class AwsTestConfig(object):
    def __init__(self):
        self.env_vars = {}
        relevant_env_vars = ['AWS_ACCESS_KEY_ID',
                             'AWS_SECRET_ACCESS_KEY',
                             'AWS_SECURITY_TOKEN']

        for name in relevant_env_vars:
            maybe_value = os.getenv(name)
            self.env_vars[name] = maybe_value

    def patch(self, test_name, default_test_bucket, monkeypatch):
        # Scrub WAL-E prefixes left around in the user's environment to
        # prevent unexpected results.
        for name in _PREFIX_VARS:
            monkeypatch.delenv(name, raising=False)

        # Set other credentials.
        for name, value in self.env_vars.iteritems():
            if value is None:
                monkeypatch.delenv(name, raising=False)
            else:
                monkeypatch.setenv(name, value)

        monkeypatch.setenv('WALE_S3_PREFIX', 's3://{0}/{1}'
                           .format(default_test_bucket, test_name))

    @property
    def name(self):
        return 'aws'


def _make_fixture_param_and_ids():
    ret = {
        'params': [],
        'ids': [],
    }<commit_msg>Move AWS credential names to top-level in testing<commit_after>import os
import pytest
import s3_integration_help
import sys

from wal_e import cmd

_PREFIX_VARS = ['WALE_S3_PREFIX', 'WALE_WABS_PREFIX', 'WALE_SWIFT_PREFIX']

_AWS_CRED_ENV_VARS = ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY',
                      'AWS_SECURITY_TOKEN']


class AwsTestConfig(object):
    def __init__(self):
        self.env_vars = {}

        for name in _AWS_CRED_ENV_VARS:
            maybe_value = os.getenv(name)
            self.env_vars[name] = maybe_value

    def patch(self, test_name, default_test_bucket, monkeypatch):
        # Scrub WAL-E prefixes left around in the user's environment to
        # prevent unexpected results.
        for name in _PREFIX_VARS:
            monkeypatch.delenv(name, raising=False)

        # Set other credentials.
        for name, value in self.env_vars.iteritems():
            if value is None:
                monkeypatch.delenv(name, raising=False)
            else:
                monkeypatch.setenv(name, value)

        monkeypatch.setenv('WALE_S3_PREFIX', 's3://{0}/{1}'
                           .format(default_test_bucket, test_name))

    @property
    def name(self):
        return 'aws'


def _make_fixture_param_and_ids():
    ret = {
        'params': [],
        'ids': [],
    }
{'fraction_non_alphanumeric': 0.09336332958380203, 'fraction_numerical': 0.0044994375703037125, 'mean_word_length': 2.269607843137255, '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': '6841641', 'n_tokens_mistral': 872, 'n_tokens_neox': 839, 'n_words': 183}