def test_should_raise_error_if_setting_configured_wrong(self): with patch.object( sys, 'argv', ['', '--settings', 'tests.samples.simple'] ): with pytest.raises(RuntimeError): from simple_settings.core import _Settings _Settings()
def test_should_raise_error_if_setting_configured_wrong(self): settings = _Settings() with patch.object( sys, 'argv', ['', '--settings', 'tests.samples.simple'] ): with pytest.raises(RuntimeError): settings.foo
def get_settings_by_environment(module_name): settings = _Settings() with patch('os.environ.get') as mock: mock.return_value = module_name settings._setup() return settings
def get_settings_by_cmd_line(module_name): settings = _Settings() with patch.object( sys, 'argv', ['', '--settings={}'.format(module_name)] ): settings._setup() return settings
def get_settings_by_cmd_line(module_name): with patch.object( sys, 'argv', ['', '--settings={}'.format(module_name)] ): from simple_settings.core import _Settings return _Settings()
def get_settings_by_environment(module_name): with patch('os.environ.get') as mock: mock.return_value = module_name from simple_settings.core import _Settings return _Settings()
def test_should_raise_error_if_dont_have_strategy_for_an_file(self): with patch.object(sys, 'argv', ['', '--settings=foo.bar']): with pytest.raises(RuntimeError): from simple_settings.core import _Settings _Settings()
def test_should_raise_error_if_setting_not_found(self): with patch.object(sys, 'argv', ['', '--settings=foo']): with pytest.raises(RuntimeError): from simple_settings.core import _Settings _Settings()
def test_should_raise_error_if_setting_are_not_configured(self): with patch.object(sys, 'argv', []): with pytest.raises(RuntimeError): from simple_settings.core import _Settings _Settings()
def test_should_raise_error_if_dont_have_strategy_for_an_file(self): settings = _Settings() with patch.object(sys, 'argv', ['', '--settings=foo.bar']): with pytest.raises(RuntimeError): settings.foo
def test_should_raise_error_if_setting_not_found(self): settings = _Settings() with patch.object(sys, 'argv', ['', '--settings=foo']): with pytest.raises(RuntimeError): settings.foo
def test_should_raise_error_if_setting_are_not_configured(self): settings = _Settings() with patch.object(sys, 'argv', []): with pytest.raises(RuntimeError): settings.foo