Commit dbc3e9af authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[tests][algorithms] Index databases used before running test using them

parent 04c0c452
......@@ -31,13 +31,27 @@
import os
import shutil
import json
from . import platform, disconnected, prefix, tmp_prefix, user, token
from ..common import Selector
from ..scripts.beat import main
from beat.core.test.utils import slow, cleanup, skipif
from beat.core.algorithm import Storage
from beat.core.database import Database
from beat.backend.python.hash import hashDataset
from beat.backend.python.hash import toPath
def index_db_from_instructions(input_field):
database = Database(prefix, input_field['database'])
view = database.view(input_field['protocol'], input_field['set'])
filename = toPath(hashDataset(input_field['database'],
view.index(os.path.join(tmp_prefix, filename))
def call(*args, **kwargs):
'''A central mechanism to call the main routine with the right parameters'''
......@@ -184,6 +198,11 @@ def test_push_and_delete():
def test_execute_algorithm_using_database():
instructions = os.path.join(os.path.dirname(__file__), 'instructions/algo_using_database.json')
with open(instructions) as instruction_file:
instructions_data = json.load(instruction_file)
input_field = instructions_data['inputs']['in']
index_db_from_instructions(input_field)'execute', instructions, cache=tmp_prefix), 0)
......@@ -218,6 +237,11 @@ def test_execute_algorithm_using_database_and_cached_files():
instructions = os.path.join(instructions_dir, 'algo_using_database_and_cached_files.json')
with open(instructions) as instruction_file:
instructions_data = json.load(instruction_file)
input_field = instructions_data['inputs']['in1']
index_db_from_instructions(input_field)'execute', instructions, cache=tmp_prefix), 0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment