# Path: datafs/_compat.py
# def open_filelike(filelike, mode='r'):


import os
import pytest
from datafs._compat import u
from fs.tempfs import TempFS
from fs.errors import ResourceNotFoundError

    api2.attach_authority('auth1', auth1)
    api2.attach_cache(cache2)

    with open('text_file.txt', 'w') as f:
        f.write(u'Stay Stoked')

    archive1 = api1.create('myArchive', versioned=False)
    archive1.update('text_file.txt')

    # Turn on caching in archive 1 and assert creation

    archive1.cache()
    assert archive1.is_cached() is True
    assert archive1.api.cache.fs is cache1

    with opener(archive1, 'w+') as f1:
        f1.write(u('Be happy and Stay Stoked'))

    assert auth1.isfile('myArchive')
    assert cache1.isfile('myArchive')

    archive2 = api2.get_archive('myArchive')

    # Turn on caching in archive 2 and assert creation
    archive2.cache()
    assert archive2.is_cached() is True
    assert archive2.api.cache.fs is cache2

    with archive2.open('r') as f:

# Path: datafs/_compat.py
# def open_filelike(filelike, mode='r'):


# Path: tests/test_removedir.py
import os
import pytest
from datafs._compat import u
from fs.tempfs import TempFS
from fs.errors import ResourceNotFoundError


    api2.attach_authority('auth1', auth1)
    api2.attach_cache(cache2)

    with open('text_file.txt', 'w') as f:
        f.write(u'Stay Stoked')

    archive1 = api1.create('myArchive', versioned=False)
    archive1.update('text_file.txt')

    # Turn on caching in archive 1 and assert creation

    archive1.cache()
    assert archive1.is_cached() is True
    assert archive1.api.cache.fs is cache1

    with opener(archive1, 'w+') as f1:
        f1.write(u('Be happy and Stay Stoked'))

    assert auth1.isfile('myArchive')
    assert cache1.isfile('myArchive')

    archive2 = api2.get_archive('myArchive')

    # Turn on caching in archive 2 and assert creation
    archive2.cache()
    assert archive2.is_cached() is True
    assert archive2.api.cache.fs is cache2

    with archive2.open('r') as f:

        assert u(f.read()) == u'Be happy and Stay Stoked'