Ejemplo n.º 1
0
def test_config_load():
    with tempfile.TemporaryDirectory() as tempdir:
        c = Config(config_dir=tempdir)
        c['foo'] = 1
        old = c.config
        c.load()
        assert c.config == old
Ejemplo n.º 2
0
def test_config_save():
    with tempfile.TemporaryDirectory() as tempdir:
        c = Config(config_dir=tempdir)
        c.save()
        old = c.config
        c.load()
        assert old == c.config
Ejemplo n.º 3
0
def test_config_save():
    with tempfile.TemporaryDirectory() as tempdir:
        c = Config(config_dir=tempdir)
        c['foo'] = 1
        c.save()
        old = c.data
        c.load()
        assert old == c.data

    with tempfile.TemporaryDirectory() as tempdir:
        c = Config(config_dir=tempdir, in_memory=True)
        c['foo'] = 1
        c.save()
        assert not Path(tempdir, 'spritzle.conf').exists()
Ejemplo n.º 4
0
def test_config_load():
    with tempfile.TemporaryDirectory() as tempdir:
        c = Config(config_dir=tempdir)
        c.load()
        assert c.data == {}
        c['foo'] = 1
        old = c.data
        c.load()
        assert c.data == old

        c = Config(config_dir=tempdir, in_memory=True)
        c.load()
        assert c.data == {}