diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b537aeb4..c5b91231 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,8 @@ jobs: - "3.8" - "3.9" - "3.10" + - "3.11" + - "3.12" include: - os: macos-latest python-version: "3.10" @@ -31,7 +33,7 @@ jobs: - name: Install and update Python dependencies on Python 3 run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade "pexpect>=3.3" 'pytest<7' rlipython 'ipykernel>=5.4.3' requests jupyter flaky 'notebook<6.1' 'prompt_toolkit<3.0.15' wheel 'jupyter_console>=6.2' 'pytest-cov<3' ipython 'coverage<6.3' pytest-json-report + python -m pip install --upgrade "pexpect>=3.3" 'pytest<=7' rlipython 'ipykernel>=5.4.3' requests jupyter flaky 'notebook<6.1' wheel 'jupyter_console>=6.2' pytest-cov ipython coverage pytest-json-report pip install -e . - name: test release build run: | @@ -61,7 +63,7 @@ jobs: ./report-*.json - uses: codecov/codecov-action@v2 - name: Build docs - if: ${{ matrix.python-version == '3.10'}} + if: ${{ matrix.python-version == '3.12'}} run: | pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints cd doc diff --git a/lib/python/pyflyby/_autoimp.py b/lib/python/pyflyby/_autoimp.py index 99861e23..a127f94f 100644 --- a/lib/python/pyflyby/_autoimp.py +++ b/lib/python/pyflyby/_autoimp.py @@ -22,7 +22,7 @@ from pyflyby._importstmt import Import from pyflyby._log import logger from pyflyby._modules import ModuleHandle -from pyflyby._parse import PythonBlock, infer_compile_mode +from pyflyby._parse import PythonBlock, infer_compile_mode, _is_ast_str if sys.version_info >= (3, 12): ATTRIBUTE_NAME = "value" @@ -34,6 +34,11 @@ else: LOAD_SHIFT = 0 +if sys.version_info > (3, 11): + LOAD_SHIFT = 1 +else: + LOAD_SHIFT = 0 + NoneType = type(None) EllipsisType = type(Ellipsis) @@ -580,7 +585,7 @@ def _visit__all__(self, node): if not isinstance(node.value, ast.List): logger.warning("Don't know how to handle __all__ as (%s)" % node.value) return - if not all(isinstance(e, ast.Str) for e in node.value.elts): + if not all(_is_ast_str(e) for e in node.value.elts): logger.warning("Don't know how to handle __all__ with list elements other than str") return for e in node.value.elts: diff --git a/tests/test_interactive.py b/tests/test_interactive.py index ce06a49f..8e8cd71b 100644 --- a/tests/test_interactive.py +++ b/tests/test_interactive.py @@ -3854,7 +3854,7 @@ def test_debug_tab_completion_db_1(frontend): """, frontend=frontend) -@retry +@pytest.mark.xfail(IPython.version_info >= (8, 14), reason='not working on tab completion since https://github.com/ipython/ipython/pull/13889') def test_debug_tab_completion_module_1(frontend, tmp): # Verify that tab completion on module names works. writetext(tmp.dir/"thornton60097181.py", """ @@ -3900,7 +3900,7 @@ def test_debug_tab_completion_multiple_1(frontend, tmp): """, PYTHONPATH=tmp.dir, frontend=frontend) -@retry +@pytest.mark.xfail(IPython.version_info >= (8, 14), reason='not working on tab completion since https://github.com/ipython/ipython/pull/13889') def test_debug_postmortem_tab_completion_1(frontend): # Verify that tab completion in %debug postmortem mode works. ipython(""" @@ -3922,7 +3922,7 @@ def test_debug_postmortem_tab_completion_1(frontend): ipdb> q """, frontend=frontend) - +@pytest.mark.xfail(IPython.version_info >= (8, 14), reason='not working on tab completion since https://github.com/ipython/ipython/pull/13889') def test_debug_namespace_1_py3(frontend): # Verify that autoimporting and tab completion happen in the local # namespace. @@ -3953,7 +3953,6 @@ def test_debug_namespace_1_py3(frontend): """, frontend=frontend) -@retry def test_debug_second_1(frontend): # Verify that a second postmortem debug of the same function behaves as # expected.