Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3952

[Python] Python test failures: TypeError: 'Buffer' object is not iterable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • python

    Description

      Since recently some Python tests started to fail - https://github.com/apache/avro/actions/runs/8111290688/job/22170288605

      py: commands_pre[0]> mkdir -p avro/test/interop /home/runner/work/avro/avro/lang/py/../../build/interop/data
      py: commands_pre[1]> cp -r /home/runner/work/avro/avro/lang/py/../../build/interop/data avro/test/interop
      py: commands_pre[2]> coverage run -pm avro.test.gen_interop_data avro/interop.avsc avro/test/interop/data/py.avro
      Traceback (most recent call last):
        File "/home/runner/work/avro/avro/lang/py/avro/test/gen_interop_data.py", line 103, in <module>
          raise SystemExit(main())
        File "/home/runner/work/avro/avro/lang/py/avro/test/gen_interop_data.py", line 98, in main
          generate(args.schema_path, op)
        File "/home/runner/work/avro/avro/lang/py/avro/test/gen_interop_data.py", line 71, in generate
          for codec, data in output:
        File "/home/runner/work/avro/avro/lang/py/avro/test/gen_interop_data.py", line 67, in <genexpr>
          output = ((codec, gen_data(codec, datum_writer, interop_schema)) for codec in CODECS_TO_VALIDATE)
        File "/home/runner/work/avro/avro/lang/py/avro/test/gen_interop_data.py", line 60, in gen_data
          dfw.flush()
        File "/home/runner/work/avro/avro/lang/py/avro/datafile.py", line 277, in flush
          self._write_block()
        File "/home/runner/work/avro/avro/lang/py/avro/datafile.py", line 241, in _write_block
          compressed_data, compressed_data_length = codec.compress(uncompressed_data)
        File "/home/runner/work/avro/avro/lang/py/avro/codecs.py", line 151, in compress
          compressed_data = snappy.compress(data)
        File "/home/runner/work/avro/avro/lang/py/.tox/py/site-packages/snappy/snappy.py", line 78, in compress
          return bytes(_compress(data))
      TypeError: 'Buffer' object is not iterable
      py: exit 1 (1.10 seconds) /home/runner/work/avro/avro/lang/py> coverage run -pm avro.test.gen_interop_data avro/interop.avsc avro/test/interop/data/py.avro pid=2134
      py: commands_post[0]> coverage combine --append
      Combined data file .coverage.fv-az882-457.2134.989353
      py: commands_post[1]> coverage report
      

      In addition running `./build.sh test` fails:

      avro/lang/py on  main [$?] via 🐍 v2.7.18 
      ❯ ./build.sh clean
      
      avro/lang/py on  main [$?] via 🐍 v2.7.18 
      ❯ ./build.sh test
      /bin/python3: No module named tox
      

      Do I need to install tox in the global libraries ? Could we (auto-)use virtual environment in build.sh ?

      Attachments

        Activity

          People

            kojiromike Michael A. Smith
            mgrigorov Martin Tzvetanov Grigorov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m