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'
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"