Exemple #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'
Exemple #2
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'
Exemple #3
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)
    with fs.open("tmp", "r") as f:
        res = f.read()
    assert res == "hi"
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())
Exemple #5
0
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
Exemple #6
0
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
Exemple #7
0
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