예제 #1
0
def comm(tmpdir):
    tmpdir = str(tmpdir)
    # Test data directory
    data_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(
        inspect.getfile(inspect.currentframe())))), "data")
    comm = Communicator()
    proj_mock = mock.MagicMock()
    proj_mock.read_only_caches = False
    proj_mock.paths = {"root": data_dir}
    comm.register("project", proj_mock)
    StationsComponent(
        stationxml_folder=os.path.join(data_dir, "station_files",
                                       "stationxml"),
        seed_folder=os.path.join(data_dir, "station_files", "seed"),
        resp_folder=os.path.join(data_dir, "station_files", "resp"),
        cache_folder=tmpdir,
        communicator=comm,
        component_name="stations")
    comm.cache_dir = tmpdir
    return comm
예제 #2
0
def comm(tmpdir):
    tmpdir = str(tmpdir)
    # Test data directory
    data_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(
        inspect.getfile(inspect.currentframe())))), "data")
    comm = Communicator()
    proj_mock = mock.MagicMock()
    proj_mock.read_only_caches = False
    proj_mock.paths = {"root": data_dir}
    comm.register("project", proj_mock)
    StationsComponent(
        stationxml_folder=os.path.join(data_dir, "station_files",
                                       "stationxml"),
        seed_folder=os.path.join(data_dir, "station_files", "seed"),
        resp_folder=os.path.join(data_dir, "station_files", "resp"),
        cache_folder=tmpdir,
        communicator=comm,
        component_name="stations")
    comm.cache_dir = tmpdir
    return comm