def test_bds_is_cacheable_for_readonly_FileStorageZODB_dict_config_with_cache( ): assert _is_cacheable( RDFLIB_PLUGIN_KEY, dict(type='FileStorageZODB', conf={'read_only': True}, cache=MagicMock()))
def test_readonly_FileStorageZODB_is_cacheable(): ''' A read-only FileStorageZODBStore is cacheable since you should be able to use it any multiple threads without any problem. OTOH, with a writeable store of that type, there is an assumption that only one thread is using the store at a time which cannot easily be assured if we "cache" the store. ''' assert _is_cacheable('FileStorageZODB', {'read_only': True})
def test_bds_is_not_cacheable_for_unknown_config_type(): assert not _is_cacheable(RDFLIB_PLUGIN_KEY, object())
def test_bds_is_not_cacheable_for_writeable_FileStorageZODB_dict_config(): assert not _is_cacheable( RDFLIB_PLUGIN_KEY, dict(type='FileStorageZODB', conf={'read_only': False}))
def test_bds_is_cacheable_for_readonly_FileStorageZODB_list_config(): assert _is_cacheable(RDFLIB_PLUGIN_KEY, ['FileStorageZODB', { 'read_only': True }])
def test_bds_is_not_cacheable_FileStorageZODB_missing_conf_key(): assert not _is_cacheable(RDFLIB_PLUGIN_KEY, dict(type='blahblah'))
def test_bds_is_not_cacheable_FileStorageZODB_overlong_tuple(): assert not _is_cacheable(RDFLIB_PLUGIN_KEY, (1, 2, 3))
def test_bds_is_not_cacheable_FileStorageZODB_overlong_list(): assert not _is_cacheable(RDFLIB_PLUGIN_KEY, [1, 2, 3])
def test_agg_with_writeable_FileStorageZODB_is_not_cacheable(): assert not _is_cacheable('agg', [['FileStorageZODB', '/tmp/blah_blah'], ['FileStorageZODB', { 'read_only': True }]])
def test_agg_with_readonly_FileStorageZODB_is_cacheable(): assert _is_cacheable('agg', [['FileStorageZODB', {'read_only': True}]])
def test_str_conf_FileStorageZODB_is_not_cacheable(): ''' By default, FileStorageZODB is a read/write store ''' assert not _is_cacheable('FileStorageZODB', '/tmp/blah_blah')
def test_readonly_false_FileStorageZODB_is_not_cacheable(): assert not _is_cacheable('FileStorageZODB', {'read_only': False})