<commit_before>import os
from unittest import TestCase

import sys
from betamax import Betamax

from pykechain import Client
from tests.utils import TEST_TOKEN, TEST_URL, TEST_SCOPE_NAME

with Betamax.configure() as config:
    config.cassette_library_dir = os.path.join(os.path.dirname(__file__), 'cassettes')
    config.define_cassette_placeholder('<API_URL>', TEST_URL)
    config.define_cassette_placeholder('<AUTH_TOKEN>', TEST_TOKEN)


class TestBetamax(TestCase):

    @property
    def cassette_name(self):
        cls = getattr(self, '__class__')
        test = self._testMethodName
        return '{0}.{1}'.format(cls.__name__, test)

    def setUp(self):
        self.client = Client(url=TEST_URL)

        if TEST_TOKEN:
            self.client.login(token=TEST_TOKEN)

        self.recorder = Betamax(session=self.client.session)
        self.recorder.use_cassette(self.cassette_name)
        self.recorder.start()
        self.project = self.client.scope(TEST_SCOPE_NAME)

    def tearDown(self):
        self.recorder.stop()

    def assertRaisesRegex(self, expected_exception, expected_regex,
                          *args, **kwargs):
        if sys.version_info.major < 3:
            return self.assertRaisesRegexp(expected_exception, expected_regex, *args, **kwargs)
        else:
            return super(__class__,self).assertRaisesRegex(expected_exception, expected_regex,
                          *args, **kwargs)<commit_msg>check why travis always fails<commit_after>import sys
from unittest import TestCase

import os
from betamax import Betamax

from pykechain import Client
from tests.utils import TEST_TOKEN, TEST_URL, TEST_SCOPE_NAME

with Betamax.configure() as config:
    config.cassette_library_dir = os.path.join(os.path.dirname(__file__), 'cassettes')
    config.define_cassette_placeholder('<API_URL>', TEST_URL)
    config.define_cassette_placeholder('<AUTH_TOKEN>', TEST_TOKEN)


class TestBetamax(TestCase):
    @property
    def cassette_name(self):
        cls = getattr(self, '__class__')
        test = self._testMethodName
        return '{0}.{1}'.format(cls.__name__, test)

    def setUp(self):
        self.client = Client(url=TEST_URL)

        print('---> ENVIRONMENT VARIABLES: {}'.format(os.environ))

        if TEST_TOKEN:
            self.client.login(token=TEST_TOKEN)

        self.recorder = Betamax(session=self.client.session)
        self.recorder.use_cassette(self.cassette_name)
        self.recorder.start()
        self.project = self.client.scope(TEST_SCOPE_NAME)

    def tearDown(self):
        self.recorder.stop()

    def assertRaisesRegex(self, expected_exception, expected_regex,
                          *args, **kwargs):
        if sys.version_info.major < 3:
            return self.assertRaisesRegexp(expected_exception, expected_regex, *args, **kwargs)
        else:
            return super(__class__, self).assertRaisesRegex(expected_exception, expected_regex,
                                                            *args, **kwargs)
{'fraction_non_alphanumeric': 0.10099337748344371, 'fraction_numerical': 0.001986754966887417, 'mean_word_length': 3.0119521912350598, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3257695', 'n_tokens_mistral': 920, 'n_tokens_neox': 909, 'n_words': 172}