Ejemplo n.º 1
0
    def test_remove(self, tmpdir):
        conf = ConfigHandler()

        with pytest.raises(AttributeError):
            conf.remove_option('SNAP', 'kex')

        with pytest.raises(AttributeError):
            conf.remove_option('SNApP', 'etc')

        conf.remove_option('FOO', 'bar')
        assert list(conf['FOO'].keys()) == []

        conf.remove_section('FOO')
Ejemplo n.º 2
0
    def test_remove(self, tmpdir):
        config = os.path.join(str(tmpdir), 'unit_test_config.ini')
        conf = ConfigHandler(config_fname=config)
        conf.add_section('SNAP')
        conf.set('SNAP', 'etc', 'temp/dir')

        with pytest.raises(AttributeError):
            conf.remove_option('SNAP', 'kex')

        with pytest.raises(AttributeError):
            conf.remove_option('SNApP', 'etc')

        conf.remove_option('SNAP', 'etc')
        assert list(conf['SNAP'].keys()) == []