potiuk opened a new issue, #35307:
URL: https://github.com/apache/airflow/issues/35307

   ### Body
   
   There is a regression that needs investigation. One of our tests is failing 
only on Python 3.11
   
`tests/operators/test_python.py::TestPythonVirtualenvOperator::test_airflow_context`
   
   This test is part of PlainAssert suite and it has been skipped so far but 
after https://github.com/apache/airflow/pull/35160  the PlainAssert (having 
only that test) have been brought back to regular tests and it turned out that 
it fails for Python 3.11
   
   The error is about dill serializing the context:
   
   ```
   INFO     airflow.utils.process_utils:process_utils.py:186 Output:
   INFO     airflow.utils.process_utils:process_utils.py:190 Traceback (most 
recent call last):
   INFO     airflow.utils.process_utils:process_utils.py:190   File 
"/tmp/venv-call7xpd4uip/script.py", line 17, in <module>
   INFO     airflow.utils.process_utils:process_utils.py:190     arg_dict = 
dill.load(file)
   INFO     airflow.utils.process_utils:process_utils.py:190                
^^^^^^^^^^^^^^^
   INFO     airflow.utils.process_utils:process_utils.py:190   File 
"/usr/local/lib/python3.11/site-packages/dill/_dill.py", line 270, in load
   INFO     airflow.utils.process_utils:process_utils.py:190     return 
Unpickler(file, ignore=ignore, **kwds).load()
   INFO     airflow.utils.process_utils:process_utils.py:190            
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   INFO     airflow.utils.process_utils:process_utils.py:190   File 
"/usr/local/lib/python3.11/site-packages/dill/_dill.py", line 472, in load
   INFO     airflow.utils.process_utils:process_utils.py:190     obj = 
StockUnpickler.load(self)
   INFO     airflow.utils.process_utils:process_utils.py:190           
^^^^^^^^^^^^^^^^^^^^^^^^^
   INFO     airflow.utils.process_utils:process_utils.py:190 TypeError: code() 
argument 13 must be str, not int
   ERROR    airflow.models.taskinstance.TaskInstance:taskinstance.py:2612 Task 
failed with exception
   ```
   
   And likely connected with similar issues reported by others.
   
   The way how to reproduce it:
   
   1) Run `breeze --python 3.11`
   2) In the test remove the `or PY311` in 
   
   ```
       @pytest.mark.skipif(
           os.environ.get("PYTEST_PLAIN_ASSERTS") != "true" or PY311,
           reason="assertion rewriting breaks this test because dill will try 
to serialize "
           ...
       )
       def test_airflow_context(self):
   ```
   3) Run this command:
   
   ```
   PYTEST_PLAIN_ASSERTS="true" pytest 
tests/operators/test_python.py::TestPythonVirtualenvOperator::test_airflow_context
 --assert=plain
   ```
   
   (Note - for this test assert rewriting in Pytest must be disabled that's why 
we have the ENV variable and --assert=plain`.
   
   
   
   
   ### Committer
   
   - [X] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to