Skip to content

2024.3.1: pytest fails in 5 fsspec/implementations/tests/test_dbfs.py::test_dbfs* units #1572

Closed
@kloczek

Description

@kloczek

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-fsspec-2024.3.1-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-fsspec-2024.3.1-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1
configfile: pyproject.toml
plugins: vcr-1.0.2, mock-3.14.0, asyncio-0.23.6
asyncio: mode=strict
collected 1618 items / 8 skipped

fsspec/implementations/tests/local/local_test.py ....................... [  1%]
........................................................................ [  5%]
........................................                                 [  8%]
fsspec/implementations/tests/memory/memory_test.py ..................... [  9%]
........................................................................ [ 14%]
..........................................                               [ 16%]
fsspec/implementations/tests/test_archive.py ........................... [ 18%]
..........................................................ssssssssssssss [ 22%]
sss                                                                      [ 22%]
fsspec/implementations/tests/test_cached.py ............................ [ 24%]
..............ssssss...............................                      [ 27%]
fsspec/implementations/tests/test_common.py ssss                         [ 28%]
fsspec/implementations/tests/test_data.py ..                             [ 28%]
fsspec/implementations/tests/test_dbfs.py FFFFFss                        [ 28%]
fsspec/implementations/tests/test_dirfs.py ............................. [ 30%]
........................................................................ [ 34%]
......................                                                   [ 36%]
fsspec/implementations/tests/test_ftp.py .............                   [ 37%]
fsspec/implementations/tests/test_http.py .............................. [ 38%]
........................                                                 [ 40%]
fsspec/implementations/tests/test_libarchive.py s                        [ 40%]
fsspec/implementations/tests/test_local.py .s........................... [ 42%]
.s.........................................................              [ 45%]
fsspec/implementations/tests/test_memory.py ............................ [ 47%]
                                                                         [ 47%]
fsspec/implementations/tests/test_reference.py ................s.....ss. [ 49%]
.s                                                                       [ 49%]
fsspec/implementations/tests/test_sftp.py ssssssssssss                   [ 50%]
fsspec/implementations/tests/test_tar.py .........................       [ 51%]
fsspec/implementations/tests/test_webhdfs.py sssssssssss                 [ 52%]
fsspec/implementations/tests/test_zip.py .........                       [ 52%]
fsspec/tests/test_api.py ...............x......                          [ 54%]
fsspec/tests/test_async.py .........s...                                 [ 55%]
fsspec/tests/test_caches.py ............................................ [ 57%]
........................................................................ [ 62%]
............................                                             [ 63%]
fsspec/tests/test_callbacks.py ........                                  [ 64%]
fsspec/tests/test_compression.py .....s                                  [ 64%]
fsspec/tests/test_config.py .......                                      [ 65%]
fsspec/tests/test_core.py .............................................. [ 68%]
..s.......                                                               [ 68%]
fsspec/tests/test_file.py ...........                                    [ 69%]
fsspec/tests/test_generic.py ......                                      [ 69%]
fsspec/tests/test_mapping.py .................                           [ 70%]
fsspec/tests/test_parquet.py sssssssssssssssssssssssssssssssssssssssssss [ 73%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 77%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 82%]
sssss                                                                    [ 82%]
fsspec/tests/test_registry.py .......s                                   [ 83%]
fsspec/tests/test_spec.py ....................x......................... [ 85%]
........................................................................ [ 90%]
........................................................................ [ 94%]
..........................                                               [ 96%]
fsspec/tests/test_utils.py ............................................. [ 99%]
............                                                             [100%]

=================================== FAILURES ===================================
____________________________ test_dbfs_file_listing ____________________________

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
>           return complexjson.loads(self.text, **kwargs)

/usr/lib/python3.10/site-packages/requests/models.py:969:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/json/__init__.py:346: in loads
    return _default_decoder.decode(s)
/usr/lib64/python3.10/json/decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x7f98e880a4d0>
s = '\x1f�\x08\x00\x00\x00\x00\x00\x04\x03��K\n�0\x10\x06�bҦ��\x01���F��6�`_$\x13\x17��ݪ\x0b���c7�\x0c\x1f̣�+�Ɓ>u�ft\x03\...��6��\x19ZQ���r1X�4}H����C)���j�hJƑ�r7Ҽ3v\x0e�\x19�\x12\x11�\x11�X�1�Ȭ3��\x17\x00\x00\x00��\x03\x00�ϭ:\x03\x03\x00\x00'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib64/python3.10/json/decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

dbfsFS = <fsspec.implementations.dbfs.DatabricksFileSystem object at 0x7f9761340280>

    @pytest.mark.vcr()
    def test_dbfs_file_listing(dbfsFS):
>       assert "/FileStore" in dbfsFS.ls("/", detail=False)

/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/tests/test_dbfs.py:127:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:75: in ls
    r = self._send_to_api(
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:271: in _send_to_api
    return r.json()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
            return complexjson.loads(self.text, **kwargs)
        except JSONDecodeError as e:
            # Catch JSON-related errors and raise as requests.JSONDecodeError
            # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
>           raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
E           requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib/python3.10/site-packages/requests/models.py:973: JSONDecodeError
_______________________________ test_dbfs_mkdir ________________________________

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
>           return complexjson.loads(self.text, **kwargs)

/usr/lib/python3.10/site-packages/requests/models.py:969:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/json/__init__.py:346: in loads
    return _default_decoder.decode(s)
/usr/lib64/python3.10/json/decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x7f98e880a4d0>
s = '\x1f�\x08\x00\x00\x00\x00\x00\x04\x03��An� \x10E�2kW�`\x06�\x07�\x05��"kZHCk\x17\x0b&��(w/���Ra9\x12�\x7f�|�p��K0<_a!....C)�X�(�p�\x00�W�\x0b��2�t���x�����7���\x1f�^~{��"n=1}��\x16;�߾B��\x14�\x17+���\x07\x00\x00��\x03\x00�rccT\x03\x00\x00'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib64/python3.10/json/decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

dbfsFS = <fsspec.implementations.dbfs.DatabricksFileSystem object at 0x7f9761340280>

    @pytest.mark.vcr()
    def test_dbfs_mkdir(dbfsFS):
        dbfsFS.rm("/FileStore/my", recursive=True)
>       assert "/FileStore/my" not in dbfsFS.ls("/FileStore/", detail=False)

/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/tests/test_dbfs.py:136:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:75: in ls
    r = self._send_to_api(
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:271: in _send_to_api
    return r.json()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
            return complexjson.loads(self.text, **kwargs)
        except JSONDecodeError as e:
            # Catch JSON-related errors and raise as requests.JSONDecodeError
            # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
>           raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
E           requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib/python3.10/site-packages/requests/models.py:973: JSONDecodeError
___________________________ test_dbfs_write_and_read ___________________________

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
>           return complexjson.loads(self.text, **kwargs)

/usr/lib/python3.10/site-packages/requests/models.py:969:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/json/__init__.py:346: in loads
    return _default_decoder.decode(s)
/usr/lib64/python3.10/json/decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x7f98e880a4d0>
s = '\x1f�\x08\x00\x00\x00\x00\x00\x04\x03��An� \x10E�2kW�`\x06�\x07�\x05��"kZHCk\x17\x0b&��(w/���Ra9\x12�\x7f�|�p��K0<_a!....C)�X�(�p�\x00�W�\x0b��2�t���x�����7���\x1f�^~{��"n=1}��\x16;�߾B��\x14�\x17+���\x07\x00\x00��\x03\x00�rccT\x03\x00\x00'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib64/python3.10/json/decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

dbfsFS = <fsspec.implementations.dbfs.DatabricksFileSystem object at 0x7f9761340280>

    @pytest.mark.vcr()
    def test_dbfs_write_and_read(dbfsFS):
        dbfsFS.rm("/FileStore/file.csv")
>       assert "/FileStore/file.csv" not in dbfsFS.ls("/FileStore/", detail=False)

/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/tests/test_dbfs.py:158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:75: in ls
    r = self._send_to_api(
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:271: in _send_to_api
    return r.json()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
            return complexjson.loads(self.text, **kwargs)
        except JSONDecodeError as e:
            # Catch JSON-related errors and raise as requests.JSONDecodeError
            # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
>           raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
E           requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib/python3.10/site-packages/requests/models.py:973: JSONDecodeError
_____________________________ test_dbfs_read_range _____________________________

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
>           return complexjson.loads(self.text, **kwargs)

/usr/lib/python3.10/site-packages/requests/models.py:969:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/json/__init__.py:346: in loads
    return _default_decoder.decode(s)
/usr/lib64/python3.10/json/decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x7f98e880a4d0>
s = '\x1f�\x08\x00\x00\x00\x00\x00\x04\x03��An� \x10E�2kW�`\x06�\x07�\x05��"kZHCk\x17\x0b&��(w/���Ra9\x12�\x7f�|�p��K0<_a!....C)�X�(�p�\x00�W�\x0b��2�t���x�����7���\x1f�^~{��"n=1}��\x16;�߾B��\x14�\x17+���\x07\x00\x00��\x03\x00�rccT\x03\x00\x00'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib64/python3.10/json/decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

dbfsFS = <fsspec.implementations.dbfs.DatabricksFileSystem object at 0x7f9761340280>

    @pytest.mark.vcr()
    def test_dbfs_read_range(dbfsFS):
        dbfsFS.rm("/FileStore/file.txt")
>       assert "/FileStore/file.txt" not in dbfsFS.ls("/FileStore/", detail=False)

/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/tests/test_dbfs.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:75: in ls
    r = self._send_to_api(
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:271: in _send_to_api
    return r.json()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
            return complexjson.loads(self.text, **kwargs)
        except JSONDecodeError as e:
            # Catch JSON-related errors and raise as requests.JSONDecodeError
            # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
>           raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
E           requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib/python3.10/site-packages/requests/models.py:973: JSONDecodeError
_________________________ test_dbfs_read_range_chunked _________________________

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
>           return complexjson.loads(self.text, **kwargs)

/usr/lib/python3.10/site-packages/requests/models.py:969:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.10/json/__init__.py:346: in loads
    return _default_decoder.decode(s)
/usr/lib64/python3.10/json/decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x7f98e880a4d0>
s = '\x1f�\x08\x00\x00\x00\x00\x00\x04\x03��An� \x10E�2kW�`\x06�\x07�\x05��"kZHCk\x17\x0b&��(w/���Ra9\x12�\x7f�|�p��K0<_a!....C)�X�(�p�\x00�W�\x0b��2�t���x�����7���\x1f�^~{��"n=1}��\x16;�߾B��\x14�\x17+���\x07\x00\x00��\x03\x00�rccT\x03\x00\x00'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib64/python3.10/json/decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

dbfsFS = <fsspec.implementations.dbfs.DatabricksFileSystem object at 0x7f9761340280>

    @pytest.mark.vcr()
    def test_dbfs_read_range_chunked(dbfsFS):
        dbfsFS.rm("/FileStore/large_file.txt")
>       assert "/FileStore/large_file.txt" not in dbfsFS.ls("/FileStore/", detail=False)

/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/tests/test_dbfs.py:190:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:75: in ls
    r = self._send_to_api(
/home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/implementations/dbfs.py:271: in _send_to_api
    return r.json()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Response [200]>, kwargs = {}

    def json(self, **kwargs):
        r"""Returns the json-encoded content of a response, if any.

        :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
        :raises requests.exceptions.JSONDecodeError: If the response body does not
            contain valid json.
        """

        if not self.encoding and self.content and len(self.content) > 3:
            # No encoding set. JSON RFC 4627 section 3 states we should expect
            # UTF-8, -16 or -32. Detect which one to use; If the detection or
            # decoding fails, fall back to `self.text` (using charset_normalizer to make
            # a best guess).
            encoding = guess_json_utf(self.content)
            if encoding is not None:
                try:
                    return complexjson.loads(self.content.decode(encoding), **kwargs)
                except UnicodeDecodeError:
                    # Wrong UTF codec detected; usually because it's not UTF-8
                    # but some other 8-bit codec.  This is an RFC violation,
                    # and the server didn't bother to tell us what codec *was*
                    # used.
                    pass
                except JSONDecodeError as e:
                    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

        try:
            return complexjson.loads(self.text, **kwargs)
        except JSONDecodeError as e:
            # Catch JSON-related errors and raise as requests.JSONDecodeError
            # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
>           raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
E           requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib/python3.10/site-packages/requests/models.py:973: JSONDecodeError
================================== XFAILURES ===================================
__________________________ test_multilevel_chained_fs __________________________

    @pytest.mark.xfail(reason="see issue #334", strict=True)
    def test_multilevel_chained_fs():
        """This test reproduces fsspec/filesystem_spec#334"""
        import zipfile

        d1 = tempfile.mkdtemp()
        f1 = os.path.join(d1, "f1.zip")
        with zipfile.ZipFile(f1, mode="w") as z:
            # filename, content
            z.writestr("foo.txt", "foo.txt")
            z.writestr("bar.txt", "bar.txt")

        # We expected this to be the correct syntax
>       with pytest.raises(IsADirectoryError):
E       Failed: DID NOT RAISE <class 'IsADirectoryError'>

fsspec/tests/test_api.py:252: Failed
__________________________________ test_find ___________________________________

    @pytest.mark.xfail
    def test_find():
        """Test .find() method on debian server (ftp, https) with constant folder"""
        filesystem, host, test_path = (
            FTPFileSystem,
            "ftp.fau.de",
            "ftp://ftp.fau.de/debian-cd/current/amd64/log/success",
        )
        test_fs = filesystem(host)
        filenames_ftp = test_fs.find(test_path)
>       assert filenames_ftp
E       assert []

fsspec/tests/test_spec.py:699: AssertionError
=============================== warnings summary ===============================
fsspec/tests/test_async.py::test_run_coros_in_chunks
  /home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/tests/test_async.py:98: RuntimeWarning: coroutine 'test_run_coros_in_chunks.<locals>.runner' was never awaited
    await asyncio.sleep(0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

fsspec/tests/test_async.py::test_async_streamed_file_write
  /home/tkloczko/rpmbuild/BUILD/filesystem_spec-2024.3.1/fsspec/asyn.py:937: RuntimeWarning: coroutine 'test_run_coros_in_chunks.<locals>.runner' was never awaited
    mth = sync_wrapper(getattr(obj, method), obj=obj)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
SKIPPED [1] fsspec/implementations/tests/test_arrow.py:5: could not import 'pyarrow.fs': No module named 'pyarrow'
SKIPPED [1] fsspec/implementations/tests/test_dask.py:5: could not import 'distributed': No module named 'distributed'
SKIPPED [1] fsspec/implementations/tests/test_git.py:11: could not import 'pygit2': No module named 'pygit2'
SKIPPED [1] fsspec/implementations/tests/test_jupyter.py:10: could not import 'notebook': No module named 'notebook'
SKIPPED [1] fsspec/implementations/tests/test_smb.py:14: could not import 'smbprotocol': No module named 'smbprotocol'
SKIPPED [1] fsspec/tests/test_downstream.py:3: could not import 's3fs': No module named 's3fs'
SKIPPED [1] fsspec/tests/test_fuse.py:9: could not import 'fuse': No module named 'fuse'
SKIPPED [1] fsspec/tests/test_gui.py:3: could not import 'panel': No module named 'panel'
SKIPPED [18] fsspec/implementations/tests/test_archive.py:45: could not import 'libarchive': No module named 'libarchive'
SKIPPED [6] fsspec/implementations/tests/test_cached.py:874: could not import 'pyarrow.fs': No module named 'pyarrow'
SKIPPED [1] fsspec/implementations/tests/test_common.py:10: could not import 'pyarrow.fs': No module named 'pyarrow'
SKIPPED [3] fsspec/implementations/tests/test_common.py:21: could not import 'pyarrow.fs': No module named 'pyarrow'
SKIPPED [1] fsspec/implementations/tests/test_dbfs.py:200: could not import 'pyarrow': No module named 'pyarrow'
SKIPPED [1] fsspec/implementations/tests/test_dbfs.py:228: could not import 'pyarrow': No module named 'pyarrow'
SKIPPED [1] fsspec/implementations/tests/test_local.py:106: could not import 's3fs': No module named 's3fs'
SKIPPED [1] fsspec/implementations/tests/test_local.py:260: could not import 'cloudpickle': No module named 'cloudpickle'
SKIPPED [1] fsspec/implementations/tests/test_reference.py:392: could not import 'zarr': No module named 'zarr'
SKIPPED [1] fsspec/implementations/tests/test_reference.py:538: could not import 'pyarrow': No module named 'pyarrow'
SKIPPED [1] fsspec/implementations/tests/test_reference.py:584: could not import 'pyarrow': No module named 'pyarrow'
SKIPPED [1] fsspec/implementations/tests/test_reference.py:692: could not import 'zarr': No module named 'zarr'
SKIPPED [1] fsspec/implementations/tests/test_sftp.py:69: docker run not available
SKIPPED [2] fsspec/implementations/tests/test_sftp.py:84: docker run not available
SKIPPED [2] fsspec/implementations/tests/test_sftp.py:102: docker run not available
SKIPPED [1] fsspec/implementations/tests/test_sftp.py:139: docker run not available
SKIPPED [1] fsspec/implementations/tests/test_sftp.py:149: docker run not available
SKIPPED [1] fsspec/implementations/tests/test_sftp.py:181: docker run not available
SKIPPED [2] fsspec/implementations/tests/test_sftp.py:203: docker run not available
SKIPPED [2] fsspec/implementations/tests/test_sftp.py:220: docker run not available
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:43: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:49: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:57: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:67: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:84: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:100: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:121: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:140: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:153: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:163: htcluster not found
SKIPPED [1] fsspec/implementations/tests/test_webhdfs.py:177: htcluster not found
SKIPPED [1] fsspec/tests/test_async.py:134: only for windows
SKIPPED [1] fsspec/tests/test_compression.py:134: could not import 'snappy': No module named 'snappy'
SKIPPED [1] fsspec/tests/test_core.py:338: could not import 's3fs': No module named 's3fs'
SKIPPED [64] fsspec/tests/test_parquet.py:37: fastparquet not found
SKIPPED [64] fsspec/tests/test_parquet.py:37: pyarrow not found
SKIPPED [64] fsspec/tests/test_parquet.py:37: No parquet engine (fastparquet or pyarrow) found
SKIPPED [1] fsspec/tests/test_registry.py:135: could not import 's3fs': No module named 's3fs'
XFAIL fsspec/tests/test_api.py::test_multilevel_chained_fs - see issue #334
XFAIL fsspec/tests/test_spec.py::test_find
FAILED fsspec/implementations/tests/test_dbfs.py::test_dbfs_file_listing - re...
FAILED fsspec/implementations/tests/test_dbfs.py::test_dbfs_mkdir - requests....
FAILED fsspec/implementations/tests/test_dbfs.py::test_dbfs_write_and_read - ...
FAILED fsspec/implementations/tests/test_dbfs.py::test_dbfs_read_range - requ...
FAILED fsspec/implementations/tests/test_dbfs.py::test_dbfs_read_range_chunked
= 5 failed, 1356 passed, 263 skipped, 2 xfailed, 2 warnings in 96.24s (0:01:36) =
List of installed modules in build env:
Package                       Version
----------------------------- -----------
aiohttp                       3.9.3
aiosignal                     1.3.1
alabaster                     0.7.16
async-timeout                 4.0.3
attrs                         23.2.0
Babel                         2.14.0
bcrypt                        4.1.2
build                         1.2.1
cffi                          1.16.0
charset-normalizer            3.3.2
cryptography                  42.0.5
docutils                      0.20.1
exceptiongroup                1.1.3
frozenlist                    1.4.1
idna                          3.7
imagesize                     1.4.1
importlib_metadata            7.1.0
iniconfig                     2.0.0
installer                     0.7.0
Jinja2                        3.1.3
lz4                           4.3.3
MarkupSafe                    2.1.5
multidict                     6.0.5
numpy                         1.26.5
numpydoc                      1.7.0
packaging                     24.0
pandas                        2.2.1
paramiko                      3.4.0
pluggy                        1.4.0
ply                           3.11
pycparser                     2.22
pyftpdlib                     1.5.7
Pygments                      2.17.2
PyNaCl                        1.5.0
pyproject_hooks               1.0.0
pytest                        8.1.1
pytest-asyncio                0.23.6
pytest-mock                   3.14.0
pytest-vcr                    1.0.2
python-dateutil               2.9.0.post0
pytz                          2024.1
PyYAML                        6.0.1
requests                      2.31.0
setuptools                    69.4.0
snowballstemmer               2.2.0
Sphinx                        7.2.6
sphinx_design                 0.5.0
sphinxcontrib-applehelp       1.0.8
sphinxcontrib-devhelp         1.0.6
sphinxcontrib-htmlhelp        2.0.5
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.7
sphinxcontrib-serializinghtml 1.1.10
tabulate                      0.9.0
tokenize_rt                   5.2.0
tomli                         2.0.1
tqdm                          4.66.2
typing_extensions             4.11.0
urllib3                       2.2.1
vcrpy                         6.0.1
wheel                         0.43.0
wrapt                         1.16.0
yarl                          1.9.4
zipp                          3.18.1
zstandard                     0.22.0

Please let me know if you need more details or want me to perform some diagnostics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions