<commit_before>from mock import patch, Mock
import pytest


from rt53 import install

class TestRt53Installer():

    def test_install_missing_requirements(self):
        with patch('rt53.install.path.exists') as pmock:
            pmock.return_value = False
            with pytest.raises(IOError):
                install.install()

    @patch('common.config')
    def test_install_pip_command(self, cfgmock):
        cfgmock.return_value = {'provider_keys': 'AWS_ACCESS_KEY|123 AWS_SECRET_KEY|abc'}
        with patch('rt53.install.subprocess') as spmock:
            spmock.check_call.return_value.returncode = 0
            install.install()
            assert(
                spmock.called_with(['pip', 'install', '-r', 'rt53-requirements.txt'])
            )

    @patch('common.config')
    def test_install_without_credentials(self, cfgmock):
        cfgmock.return_value = {'provider_keys': 'AWS_ACCESS_KEY|123'}
        with patch('rt53.install.subprocess') as spmock:
            spmock.check_call.return_value.returncode = 0
            with pytest.raises(ValueError):
                install.install()<commit_msg>Updated the cfgmock statement to comply with newer key expectations<commit_after>from mock import patch, Mock
import pytest


from rt53 import install

class TestRt53Installer():

    def test_install_missing_requirements(self):
        with patch('rt53.install.path.exists') as pmock:
            pmock.return_value = False
            with pytest.raises(IOError):
                install.install()

    @patch('common.config')
    def test_install_pip_command(self, cfgmock):
        cfgmock.return_value = {'provider_keys':
                            'AWS_ACCESS_KEY_ID|123 AWS_SECRET_ACCESS_KEY|abc'}
        with patch('rt53.install.subprocess') as spmock:
            spmock.check_call.return_value.returncode = 0
            install.install()
            assert(
                spmock.called_with(['pip', 'install', '-r', 'rt53-requirements.txt'])
            )

    @patch('common.config')
    def test_install_without_credentials(self, cfgmock):
        cfgmock.return_value = {'provider_keys': 'AWS_ACCESS_KEY|123'}
        with patch('rt53.install.subprocess') as spmock:
            spmock.check_call.return_value.returncode = 0
            with pytest.raises(ValueError):
                install.install()
{'fraction_non_alphanumeric': 0.1030664395229983, 'fraction_numerical': 0.017035775127768313, 'mean_word_length': 2.6588785046728973, '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': '7371585', 'n_tokens_mistral': 716, 'n_tokens_neox': 679, 'n_words': 128}