From 2387d34333662b4026b80837d6a0fee1af29222b 2021-10-29 03:55:12 From: Matthias Bussonnier Date: 2021-10-29 03:55:12 Subject: [PATCH] Merge pull request #13226 from Kojoley/ci-collect-coverage-gha-pytest CI: Collect coverage from GHA Pytest run --- diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0fed834..8095b87 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,7 @@ jobs: python -m pip install --upgrade pip setuptools wheel python -m pip install --upgrade -e file://$PWD#egg=ipython[test] python -m pip install --upgrade --upgrade-strategy eager trio curio - python -m pip install --upgrade pytest pytest-trio 'matplotlib!=3.2.0' + python -m pip install --upgrade pytest pytest-cov pytest-trio 'matplotlib!=3.2.0' python -m pip install --upgrade check-manifest pytest-cov anyio - name: Check manifest run: check-manifest @@ -45,6 +45,6 @@ jobs: cp /tmp/.coverage ./ - name: pytest run: | - pytest -v + pytest -v --cov --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 diff --git a/IPython/core/tests/test_debugger.py b/IPython/core/tests/test_debugger.py index ab6b3cb..d331285 100644 --- a/IPython/core/tests/test_debugger.py +++ b/IPython/core/tests/test_debugger.py @@ -247,13 +247,19 @@ def test_interruptible_core_debugger(): else: raise AssertionError("input() should only be called once!") - with patch.object(builtins, "input", raising_input): - debugger.InterruptiblePdb().set_trace() - # The way this test will fail is by set_trace() never exiting, - # resulting in a timeout by the test runner. The alternative - # implementation would involve a subprocess, but that adds issues with - # interrupting subprocesses that are rather complex, so it's simpler - # just to do it this way. + tracer_orig = sys.gettrace() + try: + with patch.object(builtins, "input", raising_input): + debugger.InterruptiblePdb().set_trace() + # The way this test will fail is by set_trace() never exiting, + # resulting in a timeout by the test runner. The alternative + # implementation would involve a subprocess, but that adds issues + # with interrupting subprocesses that are rather complex, so it's + # simpler just to do it this way. + finally: + # restore the original trace function + sys.settrace(tracer_orig) + @skip_win32 def test_xmode_skip():