From 65c463ca6c1b6190691a93ce318552f49258d4d6 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 2 Aug 2022 15:25:28 +0200 Subject: [PATCH] split mac --- .github/workflows/test.yml | 7 ++++--- tests/test_interactive.py | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1cd50c70..ce65c64f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,12 +42,13 @@ jobs: - name: compileall run: | python -We:invalid -m compileall -f -q lib/ etc/; - - name: pytest Python 2 - if: ${{ matrix.python-version == '2.7'}} + - name: pytest Python 2 or Mac OS + if: ${{ matrix.python-version == '2.7' || matrix.os == 'macos-latest'}} + # json report can't be installed on Py2, and make macos super slow. run: | python -m pytest --cov=pyflyby --cov-report=xml --doctest-modules --maxfail=3 lib tests - name: pytest Python 3 - if: ${{ matrix.python-version != '2.7'}} + if: ${{ matrix.python-version != '2.7' && matrix.os != 'macos-latest' }} run: | python -m pytest --cov=pyflyby --cov-report=xml\ --doctest-modules\ diff --git a/tests/test_interactive.py b/tests/test_interactive.py index 75ebc902..0d46704b 100644 --- a/tests/test_interactive.py +++ b/tests/test_interactive.py @@ -4183,11 +4183,44 @@ def test_debug_postmortem_tab_completion_1(frontend): """, frontend=frontend) -@pytest.mark.xfail( +@pytest.mark.skipif( + sys.version_info[0] == 2, + reason="[PYFLYBY] import base64 is not triggered at the same time depending on python versions", +) +def test_debug_namespace_1_py3(frontend): + # Verify that autoimporting and tab completion happen in the local + # namespace. + # In this example, in the local namespace, 'base64' is a variable (which + # is a string), and shouldn't refer to the global 'base64'. + ipython(""" + In [1]: import pyflyby; pyflyby.enable_auto_importer() + In [2]: def foo(x, base64): + ...: return x / base64 + ...: + In [3]: foo("Lexington", "atlantic") + --------------------------------------------------------------------------- + TypeError Traceback (most recent call last) + .... + TypeError: unsupported operand type(s) for /: 'str' and 'str' + In [4]: %debug + .... + ipdb> print(base64.cap\titalize() + b64deco\tde("UGFjaWZpYw==").decode('utf-8')) + [PYFLYBY] from base64 import b64decode + AtlanticPacific + ipdb> p b64deco\tde("Q29udGluZW50YWw=") + b'Continental' + ipdb> q + In [5]: base64.b64de\t + In [5]: base64.b64decode("SGlsbA==") + b64deco\tde("TGFrZQ==") + [PYFLYBY] from base64 import b64decode + Out[5]: b'HillLake' + """, frontend=frontend) + +@pytest.mark.skipif( sys.version_info[0] == 3, reason="[PYFLYBY] import base64 is not triggered at the same time depending on python versions", ) -def test_debug_namespace_1(frontend): +def test_debug_namespace_1_py2(frontend): # Verify that autoimporting and tab completion happen in the local # namespace. # In this example, in the local namespace, 'base64' is a variable (which