Ejemplo n.º 1
0
def test_read_my_settings_no_fixtures():
    """Make sure that settings are read correctly."""
    old_path = my_code.MY_SETTINGS_PATH
    try:
        with tempfile.TemporaryDirectory() as tmpdir:
            my_code.MY_SETTINGS_PATH = Path(tmpdir) / '.my_fake_settings'
            fake_settings = {'name': 'Paul'}
            my_code.MY_SETTINGS_PATH.write_text(json.dumps(fake_settings))
            assert my_code.read_my_settings() == fake_settings
    finally:
        my_code.MY_SETTINGS_PATH = old_path
def test_read_my_settings(monkeypatch, tmp_path, my_settings):
    """Make sure that settings are read correctly."""
    monkeypatch.setattr(my_code, "MY_SETTINGS_PATH",
                        tmp_path / ".my_fake_settings")
    my_code.MY_SETTINGS_PATH.write_text(json.dumps(my_settings))
    assert my_code.read_my_settings() == my_settings
def test_read_my_settings(my_settings):
    """Make sure that settings are read correctly."""
    my_code.MY_SETTINGS_PATH.write_text(json.dumps(my_settings))
    assert my_code.read_my_settings() == my_settings