def test_sklearn(self): if os.path.exists("./tests/out/repo2data_sklearn"): shutil.rmtree("./tests/out/repo2data_sklearn") repo2data = Repo2Data("./tests/in/sklearn.json") repo2data.install() self.assertEqual(dirhash("./tests/out/repo2data_sklearn"), dirhash("./tests/out/sklearn/repo2data_sklearn"))
def test_url(self): dir_path = "./data/repo2data_s3_binder" if os.path.exists(dir_path): shutil.rmtree(dir_path) repo2data = Repo2Data("https://github.com/ltetrel/repo2data-caching-s3") repo2data.install() dirs = os.listdir(dir_path) self.assertTrue(len(dirs) > 1)
def test_s3(self): data_req_path = "./tests/in/s3.json" with open(data_req_path, "r") as f: data_req = json.load(f) dir_path = os.path.join(data_req["dst"], data_req["projectName"]) if os.path.exists(dir_path): shutil.rmtree(dir_path) repo2data = Repo2Data(data_req_path) repo2data.install() dirs = os.listdir(dir_path) self.assertTrue(len(dirs) > 1)
def test_multiple(self): if os.path.exists("./tests/out/repo2data_multiple1"): shutil.rmtree("./tests/out/repo2data_multiple1") if os.path.exists("./tests/out/repo2data_multiple2"): shutil.rmtree("./tests/out/repo2data_multiple2") repo2data = Repo2Data("./tests/in/multiple.json") repo2data.install() self.assertTrue( os.path.exists("./tests/out/repo2data_multiple1/AUTHORS")) self.assertTrue( os.path.exists( "./tests/out/repo2data_multiple1/data_requirement.json")) self.assertTrue( os.path.exists("./tests/out/repo2data_multiple2/LICENSE")) self.assertTrue( os.path.exists( "./tests/out/repo2data_multiple2/data_requirement.json"))
# First, import the necessary modules and functions import os from pprint import pprint import matplotlib.pyplot as plt import numpy as np from myst_nb import glue from nilearn import plotting from repo2data.repo2data import Repo2Data from nimare import dataset # Install the data if running locally, or points to cached data if running on neurolibre DATA_REQ_FILE = os.path.abspath("../binder/data_requirement.json") repo2data = Repo2Data(DATA_REQ_FILE) data_path = repo2data.install() data_path = os.path.join(data_path[0], "data") # Set an output directory for any files generated during the book building process out_dir = os.path.abspath("../outputs/") os.makedirs(out_dir, exist_ok=True) # Now, load the Datasets we will use in this chapter sleuth_dset1 = dataset.Dataset.load( os.path.join(data_path, "sleuth_dset1.pkl.gz")) sleuth_dset2 = dataset.Dataset.load( os.path.join(data_path, "sleuth_dset2.pkl.gz")) neurosynth_dset = dataset.Dataset.load( os.path.join(data_path, "neurosynth_dataset.pkl.gz"))