示例#1
0
def test_CONFIGDIR_middle():
    if not windows():  # gets confused over messed up path
        with WindowsTemp(TemporaryDirectory) as dir:
            dir = canonify(dir)
            config = join(dir, '.rover')
            with open(config, 'w') as output:
                output.write('temp-dir=xx${CONFIGDIR}/foo\n')
                output.write('data-dir=xx$${CONFIGDIR}/foo\n')
            argparse = Arguments()
            args, config_path = argparse.parse_args(['-f', config])
            config = BaseConfig(None, None, args, None, dirname(config_path))
            assert config.dir(TEMPDIR)
            assert config.dir(TEMPDIR) == canonify(join(dir, 'xx' + dir + '/foo')), config.dir(TEMPDIR)
            assert config.dir(DATADIR)
            assert config.dir(DATADIR) == canonify(dir + '/xx' + canonify(dir) + '/foo'), config.dir(DATADIR)
示例#2
0
def test_CONFIGDIR_start():
    with WindowsTemp(TemporaryDirectory) as dir:
        config = join(dir, DEFAULT_FILE)
        with open(config, 'w') as output:
            output.write('temp-dir=${CONFIGDIR}/foo\n')
            output.write('data-dir=$${CONFIGDIR}/foo\n')
        argparse = Arguments()
        args, config_path = argparse.parse_args(['-f', config])
        config = BaseConfig(None, None, args, None, dirname(config_path))
        print(config.dir(TEMPDIR))
        print(config.dir(DATADIR))
        print(canonify(dir + canonify(dir) + '/foo'))
        assert config.dir(TEMPDIR)
        assert config.dir(TEMPDIR) == canonify(dir + '/foo'), config.dir(TEMPDIR)
        assert config.dir(DATADIR)
        assert config.dir(DATADIR) == canonify(dir + canonify(dir) + '/foo'), config.dir(DATADIR)
示例#3
0
 def __init__(self, dir, **kargs):
     kargs = dict(kargs)
     kargs[_(DATADIR)] = join(dir, 'data')
     kargs[_(TEMPDIR)] = join(dir, 'tmp')
     kargs[_(LOGDIR)] = join(dir, 'logs')
     root = find_root()
     kargs[_(MSEEDINDEXCMD)] = join(root, '..', 'mseedindex', 'mseedindex')
     kargs[_(LEAP)] = False
     args = TestArgs(**kargs)
     self.command = args.command
     log, log_path, log_stream = init_log(args.log_dir, '7M', 1, 5, 0, 'test', args.leap, 0)
     dbpath = join(canonify(args.data_dir), 'timeseries.sqlite')
     create_parents(dbpath)
     super().__init__(log, log_path, args, init_db(dbpath, log), dir)