Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency eval_type_backport from tests #1342

Open
pankajastro opened this issue Nov 26, 2024 · 0 comments
Open

Remove dependency eval_type_backport from tests #1342

pankajastro opened this issue Nov 26, 2024 · 0 comments
Labels
area:dependencies Related to dependencies, like Python packages, library versions, etc

Comments

@pankajastro
Copy link
Contributor

pankajastro commented Nov 26, 2024

For some Python versions tests are failing with error

Traceback (most recent call last):
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 558, in _eval_type_backport
    return _eval_type(value, globalns, localns, type_params)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 592, in _eval_type
    return typing._eval_type(  # type: ignore
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/typing.py", line 292, in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/typing.py", line 554, in _evaluate
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/bin/airflow", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/__main__.py", line 62, in main
    args.func(args)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/cli/cli_config.py", line 49, in command
    return func(*args, **kwargs)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/utils/providers_configuration_loader.py", line 55, in wrapped_function
    return func(*args, **kwargs)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/cli/commands/db_command.py", line 66, in resetdb
    db.resetdb(skip_init=args.skip_init, use_migration_files=args.use_migration_files)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/utils/session.py", line 97, in wrapper
    return func(*args, session=session, **kwargs)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/utils/db.py", line 1704, in resetdb
    import_all_models()
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/models/__init__.py", line 65, in import_all_models
    import airflow.models.serialized_dag
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/models/serialized_dag.py", line 39, in <module>
    from airflow.serialization.serialized_objects import SerializedDAG
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/serialization/serialized_objects.py", line 72, in <module>
    from airflow.serialization.pydantic.taskinstance import TaskInstancePydantic
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/airflow/serialization/pydantic/taskinstance.py", line [84](https://github.com/astronomer/astronomer-cosmos/actions/runs/12018236731/job/33502303435?pr=1340#step:7:85), in <module>
    class TaskInstancePydantic(BaseModelPydantic, LoggingMixin):
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 221, in __new__
    set_model_fields(cls, bases, config_wrapper, ns_resolver)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 593, in set_model_fields
    fields, class_vars = collect_model_fields(cls, bases, config_wrapper, ns_resolver, typevars_map=typevars_map)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_fields.py", line 112, in collect_model_fields
    type_hints = _typing_extra.get_cls_type_hints(cls, ns_resolver=ns_resolver, lenient=True)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 472, in get_cls_type_hints
    hints[name] = eval_type(value, globalns, localns, lenient=lenient)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 4[98](https://github.com/astronomer/astronomer-cosmos/actions/runs/12018236731/job/33502303435?pr=1340#step:7:99), in eval_type
    return eval_type_backport(value, globalns, localns)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 534, in eval_type_backport
    return _eval_type_backport(value, globalns, localns, type_params)
  File "/home/runner/.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.9-2.10/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 566, in _eval_type_backport
    raise TypeError(
TypeError: Unable to evaluate type annotation 'logging.Logger | None'. If you are making use of the new typing syntax (unions using `|` since Python 3.10 or builtins subscripting since Python 3.9), you should either replace the use of new syntax with the existing `typing` constructs or install the `eval_type_backport` package

CI: https://github.com/astronomer/astronomer-cosmos/actions/runs/12018236731/job/33502303435?pr=1340

@dosubot dosubot bot added the area:dependencies Related to dependencies, like Python packages, library versions, etc label Nov 26, 2024
pankajastro added a commit that referenced this issue Nov 26, 2024
…re Clone Test to Pass CI (#1337)

closes: #1335

- Disabled "Run-Integration-Tests-Sqlite" Job and created issue
#1341 to enable it
- Installed `eval_type_backport` in tests and created an issue
#1342 to remove it
- pin dbt version dbt-core<1.8.9 created issue to unpin it
#1343
- pin dbt version for Kubernetes tests and create issue to unpin it
#1344

CI success:
https://github.com/astronomer/astronomer-cosmos/actions/runs/12026097151/job/33524412817?pr=1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dependencies Related to dependencies, like Python packages, library versions, etc
Projects
None yet
Development

No branches or pull requests

1 participant