<s> import logging <EOL> from riak import RiakError <EOL> from riak . tests import RUN_YZ <EOL> from riak . tests . base import IntegrationTestBase <EOL> def yzSetUp ( * yzdata ) : <EOL> if RUN_YZ : <EOL> c = IntegrationTestBase . create_client ( ) <EOL> for yz in yzdata : <EOL> logging . debug ( "<STR_LIT>" , yz ) <EOL> c . create_search_index ( yz [ '<STR_LIT:index>' ] , timeout = <NUM_LIT> ) <EOL> if yz [ '<STR_LIT>' ] is not None : <EOL> t = c . bucket_type ( yz [ '<STR_LIT>' ] ) <EOL> b = t . bucket ( yz [ '<STR_LIT>' ] ) <EOL> else : <EOL> b = c . bucket ( yz [ '<STR_LIT>' ] ) <EOL> index_set = False <EOL> while not index_set : <EOL> try : <EOL> b . set_property ( '<STR_LIT>' , yz [ '<STR_LIT:index>' ] ) <EOL> index_set = True <EOL> except RiakError : <EOL> pass <EOL> c . close ( ) <EOL> def yzTearDown ( c , * yzdata ) : <EOL> if RUN_YZ : <EOL> c = IntegrationTestBase . create_client ( ) <EOL> for yz in yzdata : <EOL> logging . debug ( "<STR_LIT>" , yz ) <EOL> if yz [ '<STR_LIT>' ] is not None : <EOL> t = c . bucket_type ( yz [ '<STR_LIT>' ] ) <EOL> b = t . bucket ( yz [ '<STR_LIT>' ] ) <EOL> else : <EOL> b = c . bucket ( yz [ '<STR_LIT>' ] ) <EOL> b . set_property ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> c . delete_search_index ( yz [ '<STR_LIT:index>' ] ) <EOL> for keys in b . stream_keys ( ) : <EOL> for key in keys : <EOL> b . delete ( key ) <EOL> c . close ( ) </s>
