def test_disable_undo(database, download_query, tmpdir): entry = DatabaseEntry() with disable_undo(database) as db: db.set_cache_size(5) db.add(entry) db.commit() db.remove(entry) db.default_waveunit = 'angstrom' db.download(*download_query, path=str(tmpdir.join('{file}.fits'))) entry = db[0] db.tag(entry, 'foo', 'bar') db.remove_tag(entry, 'foo') db.star(entry) db.unstar(entry) db.add_many([entry, entry], ignore_already_added=True) db.add(entry, ignore_already_added=True) db.add_from_dir(str(tmpdir)) db.clear() with pytest.raises(EmptyCommandStackError): database.undo()
def test_disable_undo(database, download_query, tmpdir): entry = DatabaseEntry() with disable_undo(database) as db: db.set_cache_size(5) db.add(entry) db.commit() db.remove(entry) db.default_waveunit = 'angstrom' db.download(*download_query, path=str(tmpdir.join('{file}.fits'))) entry = db[0] db.tag(entry, 'foo', 'bar') db.remove_tag(entry, 'foo') db.star(entry) db.unstar(entry) db.add_many([entry, entry], ignore_already_added=True) db.add(entry, ignore_already_added=True) db.add_from_dir(str(tmpdir)) db.clear() with pytest.raises(EmptyCommandStackError): database.undo()