コード例 #1
0
def test_abs_paths(tmpdir):
    tmpdir = str(tmpdir)
    here = os.getcwd()
    os.chdir(tmpdir)
    with open('tmp', 'w') as f:
        f.write('hi')
    out = LocalFileSystem().glob('*')
    assert len(out) == 1
    assert os.sep in out[0]
    assert tmpdir in out[0] and 'tmp' in out[0]

    fs = LocalFileSystem()
    os.chdir(here)
    assert fs.open('tmp', 'r').read() == 'hi'
コード例 #2
0
ファイル: test_local.py プロジェクト: fortizc/dask
def test_abs_paths(tmpdir):
    tmpdir = str(tmpdir)
    here = os.getcwd()
    os.chdir(tmpdir)
    with open('tmp', 'w') as f:
        f.write('hi')
    out = LocalFileSystem().glob('*')
    assert len(out) == 1
    assert os.sep in out[0]
    assert tmpdir in out[0] and 'tmp' in out[0]

    fs = LocalFileSystem()
    os.chdir(here)
    assert fs.open('tmp', 'r').read() == 'hi'
コード例 #3
0
ファイル: test_local.py プロジェクト: tingzhendu/dask
def test_abs_paths(tmpdir):
    tmpdir = str(tmpdir)
    here = os.getcwd()
    os.chdir(tmpdir)
    with open("tmp", "w") as f:
        f.write("hi")
    out = LocalFileSystem().glob("*")
    assert len(out) == 1
    assert os.sep in out[0]
    assert tmpdir in out[0] and "tmp" in out[0]

    fs = LocalFileSystem()
    os.chdir(here)
    with fs.open("tmp", "r") as f:
        res = f.read()
    assert res == "hi"
コード例 #4
0
def test_get_pyarrow_filesystem():
    pa = pytest.importorskip('pyarrow')

    fs = LocalFileSystem()
    assert isinstance(get_pyarrow_filesystem(fs), pa.filesystem.LocalFileSystem)

    with pytest.raises(NotImplementedError):
        get_pyarrow_filesystem(UnknownFileSystem())
コード例 #5
0
ファイル: test_local.py プロジェクト: mathewlee11/dask
def test_getsize(fmt):
    compress = compression.compress[fmt]
    with filetexts({'.tmp.getsize': compress(b'1234567890')}, mode='b'):
        fs = LocalFileSystem()
        assert logical_size(fs, '.tmp.getsize', fmt) == 10
コード例 #6
0
ファイル: test_local.py プロジェクト: gameduell/dask
def test_getsize(fmt):
    fs = LocalFileSystem()
    compress = compression.compress[fmt]
    with filetexts({'.tmp.getsize': compress(b'1234567890')}, mode='b'):
        assert fs.logical_size('.tmp.getsize', fmt) == 10
コード例 #7
0
ファイル: test_local.py プロジェクト: tingzhendu/dask
def test_getsize(fmt):
    compress = compression.compress[fmt]
    with filetexts({".tmp.getsize": compress(b"1234567890")}, mode="b"):
        fs = LocalFileSystem()
        assert logical_size(fs, ".tmp.getsize", fmt) == 10