Skip to content

Commit

Permalink
Fix functools cache test issue (#742)
Browse files Browse the repository at this point in the history
Fix exceptions raised for some versions of Python (e.g. 2.4) after
prematurely merging #732, leading to the main branch becoming red
```
../../../.local/share/hatch/env/virtual/astronomer-cosmos/Za_bFbg4/tests.py3.8-2.5/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
tests/test_example_dags_no_connections.py:4: in <module>
    from functools import cache
E   ImportError: cannot import name 'cache' from 'functools'
```
  • Loading branch information
tatiana authored Dec 4, 2023
1 parent a2c58f5 commit e9950d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tests/test_example_dags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from __future__ import annotations

from pathlib import Path
from functools import cache

try:
from functools import cache
except ImportError:
from functools import lru_cache as cache


import airflow
import pytest
Expand Down
6 changes: 5 additions & 1 deletion tests/test_example_dags_no_connections.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from __future__ import annotations

from pathlib import Path
from functools import cache

try:
from functools import cache
except ImportError:
from functools import lru_cache as cache

import airflow
import pytest
Expand Down

0 comments on commit e9950d7

Please sign in to comment.