redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.85k stars 126 forks source link

Tests fail when using Python 3.11 #352

Open ANogin opened 1 year ago

ANogin commented 1 year ago

What is the problem? (Here is where you provide a complete Traceback.) Not sure whether this is something to particularly care about, but just in case - I noticed that some test fail when using Python 3.11

Please provide some information about your environment.

$ git rev-parse HEAD
d12b520a5a37634b3272b1aac533fa6c9279388d
$ git diff
diff --git a/build_image.py b/build_image.py
index 1ebe4d7..14f5e2f 100644
--- a/build_image.py
+++ b/build_image.py
@@ -195,7 +195,7 @@ def create_dockerfile_base(config: OfrakImageConfig) -> str:
         dockerfile_base_parts += [f"### {dockerstage_path}", dockerstub]

     dockerfile_base_parts += [
-        "FROM python:3.7-bullseye@sha256:338ead05c1a0aa8bd8fcba8e4dbbe2afd0283b4732fd30cf9b3bfcfcbc4affab",
+        "FROM python:3.11-bullseye",
         "",
     ]

diff --git a/ofrak_core/Dockerstub b/ofrak_core/Dockerstub
index 03ee750..a377e98 100644
--- a/ofrak_core/Dockerstub
+++ b/ofrak_core/Dockerstub
@@ -65,7 +65,4 @@ RUN cd /tmp && \
     python3 setup.py install

 # Install Jefferson
-WORKDIR /tmp
-RUN wget https://bootstrap.pypa.io/pip/get-pip.py && python3.9 get-pip.py && python3.7 get-pip.py && rm get-pip.py
-RUN python3.9 -m pip install jefferson
-WORKDIR /
+RUN python3 -m pip install jefferson

If you've discovered it, what is the root cause of the problem? Not sure

How often does the issue happen? Always

What are the steps to reproduce the issue?

$ DOCKER_BUILDKIT=1 python3 build_image.py --config ofrak-core-dev.yml --base --finish --target=develop
[...]
 => => naming to docker.io/redballoonsecurity/ofrak/core-dev:latest
$ docker run -it --rm redballoonsecurity/ofrak/core-dev:latest make test
[...]
========================================================================================================================================== short test summary info ==========================================================================================================================================
FAILED ofrak_io_test/test_batch_manager.py::test_single_result[batch_manager_with_function] - TypeError: Passing coroutines is forbidden, use tasks explicitly.
FAILED ofrak_io_test/test_batch_manager.py::test_incomplete_handling_raises_err - TypeError: Passing coroutines is forbidden, use tasks explicitly.
FAILED ofrak_io_test/test_batch_manager.py::test_single_result[batch_manager_with_subclass] - TypeError: Passing coroutines is forbidden, use tasks explicitly.
FAILED ofrak_io_test/test_batch_manager.py::test_many_results[batch_manager_with_function] - TypeError: Passing coroutines is forbidden, use tasks explicitly.
FAILED ofrak_io_test/test_batch_manager.py::test_many_results[batch_manager_with_subclass] - TypeError: Passing coroutines is forbidden, use tasks explicitly.
================================================================================================================================= 5 failed, 36 passed, 23 warnings in 3.76s =================================================================================================================================
make[1]: *** [Makefile:18: test] Error 1
make[1]: Leaving directory '/ofrak_io'
make: *** [Makefile:10: test] Error 2

How would you implement this fix? Not sure

Are there any (reasonable) alternative approaches? Not sure

Are you interested in implementing it yourself? Probably not