[ 
https://issues.apache.org/jira/browse/AVRO-3952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17822537#comment-17822537
 ] 

Martin Tzvetanov Grigorov edited comment on AVRO-3952 at 3/1/24 12:39 PM:
--------------------------------------------------------------------------

{code}
diff --git i/lang/py/build.sh w/lang/py/build.sh
index 000e048cf..f00013b1a 100755
--- i/lang/py/build.sh
+++ w/lang/py/build.sh
@@ -76,7 +76,10 @@ lint() {
 }
 
 test_() {
-  TOX_SKIP_ENV=lint python3 -m tox --skip-missing-interpreters
+  virtualenv="$(mktemp -d)"
+  python3 -m venv "$virtualenv"
+  "$virtualenv/bin/python3" -m pip install tox
+  TOX_SKIP_ENV=lint "$virtualenv/bin/python3" -m tox 
--skip-missing-interpreters
 }
 
 main() {
{code}

This patch helped to execute the tests. They pass with Python 3.10.12, but the 
CI fails for Python 3.7 and 3.8


was (Author: mgrigorov):
{code:diff}
diff --git i/lang/py/build.sh w/lang/py/build.sh
index 000e048cf..f00013b1a 100755
--- i/lang/py/build.sh
+++ w/lang/py/build.sh
@@ -76,7 +76,10 @@ lint() {
 }
 
 test_() {
-  TOX_SKIP_ENV=lint python3 -m tox --skip-missing-interpreters
+  virtualenv="$(mktemp -d)"
+  python3 -m venv "$virtualenv"
+  "$virtualenv/bin/python3" -m pip install tox
+  TOX_SKIP_ENV=lint "$virtualenv/bin/python3" -m tox 
--skip-missing-interpreters
 }
 
 main() {
{code}

This patch helped to execute the tests. They pass with Python 3.10.12, but the 
CI fails for Python 3.7 and 3.8

> [Python] Python test failures: TypeError: 'Buffer' object is not iterable
> -------------------------------------------------------------------------
>
>                 Key: AVRO-3952
>                 URL: https://issues.apache.org/jira/browse/AVRO-3952
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: python
>            Reporter: Martin Tzvetanov Grigorov
>            Assignee: Michael A. Smith
>            Priority: Major
>
> Since recently some Python tests started to fail - 
> https://github.com/apache/avro/actions/runs/8111290688/job/22170288605
> {code}
> 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
> {code}
> In addition running `./build.sh test` fails:
> {code}
> 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
> {code}
> Do I need to install tox in the global libraries ? Could we (auto-)use 
> virtual environment in build.sh ?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to