Esempio n. 1
0
def dts_df(request):
    (df, csv_data) = test_plot_utils.dataset(40)
    tempd = tempfile.mkdtemp(prefix="bdbcontrib-test-recipes")
    request.addfinalizer(lambda: shutil.rmtree(tempd))
    csv_path = os.path.join(tempd, "data.csv")
    with open(csv_path, "w") as csv_f:
        csv_f.write(csv_data.getvalue())
    bdb_path = os.path.join(tempd, "data.bdb")
    name = ''.join(random.choice(ascii_lowercase) for _ in range(32))
    dts = recipes.quickstart(name=name,
                             csv_path=csv_path, bdb_path=bdb_path,
                             logger=CaptureLogger(
                                 verbose=pytest.config.option.verbose),
                             session_capture_name="test_recipes.py")
    ensure_timeout(10, lambda: dts.analyze(models=10, iterations=20))
    return dts, df
Esempio n. 2
0
def prepare():
    if testvars['dataset'] is None:
        (df, csv_data) = test_plot_utils.dataset(40)
        tempd = tempfile.mkdtemp(prefix="bdbcontrib-test-population")
        csv_path = os.path.join(tempd, "data.csv")
        with open(csv_path, "w") as csv_f:
            csv_f.write(csv_data.getvalue())
        bdb_path = os.path.join(tempd, "data.bdb")
        name = ''.join(random.choice(ascii_lowercase) for _ in range(32))
        dts = quickstart(name=name, csv_path=csv_path, bdb_path=bdb_path,
                         logger=CaptureLogger(
                             verbose=pytest.config.option.verbose),
                         session_capture_name="test_population.py")
        ensure_timeout(10, lambda: dts.analyze(models=10, iterations=20))
        testvars['dataset'] = dts
        testvars['input_df'] = df

    yield testvars['dataset'], testvars['input_df']
def prepare():
    if testvars['dataset'] is None:
        (df, csv_data) = test_plot_utils.dataset(40)
        tempd = tempfile.mkdtemp(prefix="bdbcontrib-test-population")
        csv_path = os.path.join(tempd, "data.csv")
        with open(csv_path, "w") as csv_f:
            csv_f.write(csv_data.getvalue())
        bdb_path = os.path.join(tempd, "data.bdb")
        name = ''.join(random.choice(ascii_lowercase) for _ in range(32))
        dts = Population(
            name=name,
            csv_path=csv_path,
            bdb_path=bdb_path,
            logger=CaptureLogger(verbose=pytest.config.option.verbose),
            session_capture_name="test_population.py")
        ensure_timeout(10, lambda: dts.analyze(models=10, iterations=20))
        testvars['dataset'] = dts
        testvars['input_df'] = df

    yield testvars['dataset'], testvars['input_df']