def test_dockerignore(self) -> None:
    fs = fsspec.filesystem('memory')
    files = ['dockerignore/ignoredir/bar', 'dockerignore/dir1/bar', 'dockerignore/dir/ignorefileglob1', 'dockerignore/dir/recursive/ignorefileglob2', 'dockerignore/dir/ignorefile', 'dockerignore/ignorefile', 'dockerignore/ignorefilesuffix', 'dockerignore/dir/file', 'dockerignore/foo.sh', 'dockerignore/unignore']
    for file in files:
        fs.touch(file)
    with fs.open('dockerignore/.dockerignore', 'wt') as f:
        f.write('\n                # comment\n\n                # dirs/files\n                ignoredir\n                ignorefile\n\n                # globs\n                */ignorefileglo*1\n                **/ignorefileglob2\n                dir?\n\n                # inverse patterns\n                unignore\n                !unignore\n\n                # ignore .\n                .\n            ')
    with _build_context('img', 'memory://dockerignore') as f:
        with tarfile.open(fileobj=f, mode='r') as tf:
            self.assertCountEqual(tf.getnames(), {'Dockerfile.torchx', 'foo.sh', '.dockerignore', 'dir/ignorefile', 'ignorefilesuffix', 'dir/file', 'unignore'})
def test_dockerignore(self) -> None:
    fs = fsspec.filesystem('memory')
    files = ['dockerignore/ignoredir/bar', 'dockerignore/dir1/bar', 'dockerignore/dir/ignorefileglob1', 'dockerignore/dir/recursive/ignorefileglob2', 'dockerignore/dir/ignorefile', 'dockerignore/ignorefile', 'dockerignore/ignorefilesuffix', 'dockerignore/dir/file', 'dockerignore/foo.sh', 'dockerignore/unignore']
    for file in files:
        fs.touch(file)
    with fs.open('dockerignore/.dockerignore', 'wt') as f:
        f.write('\n                # comment\n\n                # dirs/files\n                ignoredir\n                ignorefile\n\n                # globs\n                */ignorefileglo*1\n                **/ignorefileglob2\n                dir?\n\n                # inverse patterns\n                unignore\n                !unignore\n\n                # ignore .\n                .\n            ')
    with _build_context('img', 'memory://dockerignore') as f:
        with tarfile.open(fileobj=f, mode='r') as tf:
            self.assertCountEqual(tf.getnames(), {'Dockerfile.torchx', 'foo.sh', '.dockerignore', 'dir/ignorefile', 'ignorefilesuffix', 'dir/file', 'unignore'})