def step_impl(context, source, db): source = expand_scenario_variables(context, source) context.imported = source with open(os.path.join(ROOT, 'test', 'fixtures', source)) as f: data = json.load(f) items = data['items'] #references = sum([ 1 + len(item.get('attachments', [])) + len(item.get('notes', [])) for item in items ]) references = len(items) dbs = os.path.join(ROOT, 'test', 'db', db) if not os.path.exists(dbs): os.makedirs(dbs) zotero = os.path.join(dbs, 'zotero.sqlite') if not os.path.exists(zotero): urllib.request.urlretrieve( f'https://github.com/retorquere/zotero-better-bibtex/releases/download/test-database/{db}.zotero.sqlite', zotero) bbt = os.path.join(dbs, 'better-bibtex.sqlite') if not os.path.exists(bbt): urllib.request.urlretrieve( f'https://github.com/retorquere/zotero-better-bibtex/releases/download/test-database/{db}.better-bibtex.sqlite', bbt) timeout = context.zotero.timeout context.zotero.shutdown() context.zotero = Zotero(context.config.userdata, db=Munch(zotero=zotero, bbt=bbt)) context.zotero.timeout = timeout assert_that( context.zotero.execute( 'return await Zotero.BetterBibTeX.TestSupport.librarySize()'), equal_to(references)) context.zotero.import_file(context, source, items=False)
def before_all(context): context.zotero = Zotero(context.config.userdata) # test whether the existing references, if any, have gotten a cite key context.zotero.export_library(translator='Better BibTeX')
def before_all(context): context.zotero = Zotero(context.config.userdata) setup_active_tag_values(active_tag_value_provider, context.config.userdata) # test whether the existing references, if any, have gotten a cite key context.zotero.export_library(translator = 'Better BibTeX')