def test_settings_arg_overrides_env_var(self): sys.argv = ['helga', '--settings', 'bar'] with patch.multiple(helga, run=Mock(), settings=Mock()): with patch.dict('os.environ', {'HELGA_SETTINGS': 'foo'}): helga.main() helga.settings.configure.assert_called_with('bar') assert helga.run.called
def test_uses_settings_env_var(monkeypatch): sys.argv = ['helga'] with patch.multiple(helga, run=Mock(), settings=Mock()): with patch.dict('os.environ', {'HELGA_SETTINGS': 'foo'}): helga.main() helga.settings.configure.assert_called_with('foo') assert helga.run.called