예제 #1
0
def test_start_project():
    expected = ['README.txt', 'src', 'data', 'config.txt', 'outputs']
    start_project("tests/sampletest")
    output = os.listdir("tests/sampletest/")
    assert set(expected) == set(output)
    assert len(expected) == len(output)
    # clean directory
    shutil.rmtree("tests/sampletest")
예제 #2
0
def test_save_outputs_csv(
):  #Test data saving in a directory structure created with datasist start_project function
    expected = 'proc_outputs.csv'

    start_project("tests/sampletest")  #create test folder structure
    config_path = os.path.join('tests/sampletest', 'config.txt')
    with open(config_path) as configfile:
        config = json.load(configfile)

    output_path = os.path.join(config['outputpath'])
    aa = pd.DataFrame([1, 2, 3, 4, 5])
    save_outputs(data=aa, name=output_path + '/proc_outputs', method='csv')

    assert expected in os.listdir(output_path)
    shutil.rmtree("tests/sampletest")
예제 #3
0
def test_save_data_jbl(
):  #Test data saving in a directory structure created with datasist start_project function
    expected1 = 'proc_file.jbl'
    expected2 = 'raw_file.jbl'

    start_project("tests/sampletest")  #create test folder structure
    config_path = os.path.join('tests/sampletest', 'config.txt')
    with open(config_path) as configfile:
        config = json.load(configfile)

    data_path_raw = os.path.join(config['datapath'], 'raw')
    data_path_proc = os.path.join(config['datapath'], 'processed')

    aa = pd.DataFrame([1, 2, 3, 4, 5])

    save_data(aa,
              name=data_path_proc + '/proc_file',
              method='joblib',
              loc='processed')
    save_data(aa, name=data_path_raw + '/raw_file', method='joblib', loc='raw')

    assert expected1 in os.listdir(data_path_proc)
    assert expected2 in os.listdir(data_path_raw)
    shutil.rmtree("tests/sampletest")
예제 #4
0
def test_start_project():
    expected = ['README.txt', 'src', 'data', 'config.txt', 'outputs']
    project.start_project("tests/sampletest")
    output = os.listdir("tests/sampletest")
    assert set(expected) == set(output)
    assert len(expected) == len(output)
예제 #5
0
def setup_function(module):
    project.start_project("tests/sampletest")
    logging.info("starting")