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

run python ci tests on prerelease branches and pin ipython to <=8.31.0 #6552

Merged
merged 5 commits into from
Mar 1, 2025

Conversation

sharon-wang
Copy link
Member

@sharon-wang sharon-wang commented Feb 28, 2025

Summary

  • Python CI tests will now run on prerelease branch PRs starting from prerelease/2025.03
  • Python CI tests will run when commits are pushed to prerelease branches
  • pins ipython to <=8.31.0 to avoid a test failure occurring in the Python IPyKernel tests on this branch and on the main branch
    FAILED python_files/posit/positron/tests/test_positron_ipkernel.py::test_console_traceback - AttributeError: 'AutoFormattedTB' object has no attribute 'Colors'
    
  • pulls in use posit cdn instead of github release asset for download url #6496 to fix up python CI tests on mac

NOTE: This change will need to go into main as well!

Copy link

github-actions bot commented Feb 28, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

@sharon-wang sharon-wang marked this pull request as ready for review February 28, 2025 17:43
@sharon-wang
Copy link
Member Author

sharon-wang commented Feb 28, 2025

Hmm, the ipykernel tests are failing even after a rerun with:

====================================================== FAILURES ======================================================
_______________________________________________ test_console_traceback _______________________________________________
shell = <positron.positron_ipkernel.PositronShell object at 0x7f20fdbaad50>
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_console_traceback0')
mock_displayhook = <Mock id='139779566843792'>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f20f5f6ad50>
    def test_console_traceback(
        shell: PositronShell, tmp_path: Path, mock_displayhook: Mock, monkeypatch
    ) -> None:
        # Ensure that we're in console mode.
        monkeypatch.setattr(shell, "session_mode", SessionMode.CONSOLE)
    
        # We follow the approach of IPython's test_ultratb.py, which is to create a temporary module,
        # prepend its parent directory to sys.path, import it, then run a cell that calls a function
        # from it.
    
        # Create a temporary module.
        file = tmp_path / "test_traceback.py"
        file.write_text(code)
    
        # Temporarily add the module to sys.path and call a function from it, which should error.
        with prepended_to_syspath(str(tmp_path)):
            shell.run_cell("import test_traceback; test_traceback.g()")
    
        # NOTE(seem): This is not elegant, but I'm not sure how else to test this than other than to
        # compare the beginning of each frame of the traceback. The escape codes make it particularly
        # challenging.
    
        path = str(alias_home(file))
        uri = file.expanduser().as_uri()
    
        # Define a few OSC8 escape codes for convenience.
        esc = "\x1b"
        osc8 = esc + "]8"
        st = esc + "\\"
    
        # Convenient reference to colors from the active scheme.
>       colors = cast(Any, shell.InteractiveTB.Colors)
E       AttributeError: 'AutoFormattedTB' object has no attribute 'Colors'
python_files/posit/positron/tests/test_positron_ipkernel.py:162: AttributeError

Is the prerelease branch missing a fix for this?

EDIT: this is also failing for branches targeting main

Copy link
Contributor

@jonvanausdeln jonvanausdeln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@isabelizimm
Copy link
Contributor

isabelizimm commented Feb 28, 2025

without looking into it much, it sort of looks like something in the test requirements got updated and is now breaking. We generally pin all our dependencies, but there's one file that does not: https://github.com/posit-dev/positron/blob/db8f78b2bf2964778b039e8d0e01f02ef70ec3a0/extensions/positron-python/build/test-requirements.txt

update to mention that ipython, which imports AutoFormattedTB had a fresh 9.0.0 release earlier today

@sharon-wang sharon-wang force-pushed the run-python-ci-on-prerelease-branches branch from 5220460 to 4ac7514 Compare February 28, 2025 20:43
@sharon-wang
Copy link
Member Author

without looking into it much, it sort of looks like something in the test requirements got updated and is now breaking. We generally pin all our dependencies, but there's one file that does not: https://github.com/posit-dev/positron/blob/db8f78b2bf2964778b039e8d0e01f02ef70ec3a0/extensions/positron-python/build/test-requirements.txt

update to mention that ipython, which imports AutoFormattedTB had a fresh 9.0.0 release earlier today

Thank you for this tip!! Pinned ipython<=8.31.0 and now the ipykernel tests are all green ✅ 🎉

@sharon-wang sharon-wang changed the title run python ci tests on prerelease branches run python ci tests on prerelease branches and pin ipython to <=8.31.0 Feb 28, 2025
sharon-wang and others added 5 commits February 28, 2025 17:26
We no longer publish the release binaries as assets, but the
`downloadAndUnzipPositron()` function still assumes that we do.

This PR updates the script to use the CDN url so we shouldn't see this
error anymore when running Python extension MacOS tests:

```
Run GabrielBB/xvfb-action@v1.7
/Users/runner/hostedtoolcache/node/20.12.1/arm64/bin/npm run testDebugger

> python@2025.99.0-dev testDebugger
> node ./out/test/testBootstrap.js ./out/test/debuggerTest.js

Test server listening on port 49253
****************************************************************************************************
Start Debugger tests
Using Github PAT from environment variable POSITRON_GITHUB_PAT.
End Debugger tests (with errors) Error: No asset found with suffix .dmg for platform darwin
    at downloadAndUnzipPositron (/Users/runner/work/positron/positron/path with spaces/extensions/positron-python/out/test/positron/testElectron.js:197:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runTests (/Users/runner/work/positron/positron/path with spaces/extensions/positron-python/out/test/positron/testElectron.js:269:63)
Exiting with test failures
Killing VSC
Error: The process '/Users/runner/hostedtoolcache/node/20.12.1/arm64/bin/npm' failed with exit code 1
```

### QA Notes

Python Mac OS tests should now pass locally and in CI.
Co-authored-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com>
Signed-off-by: sharon <sharon-wang@users.noreply.github.com>
Error in tests:
```
FAILED python_files/posit/positron/tests/test_positron_ipkernel.py::test_console_traceback - AttributeError: 'AutoFormattedTB' object has no attribute 'Colors'
```

from Isabel:
> ipython, which imports  AutoFormattedTB had a fresh 9.0.0 release earlier today
@sharon-wang sharon-wang force-pushed the run-python-ci-on-prerelease-branches branch from 4949dae to ecf2af1 Compare February 28, 2025 22:29
@petetronic petetronic merged commit 91b2944 into prerelease/2025.03 Mar 1, 2025
28 checks passed
@petetronic petetronic deleted the run-python-ci-on-prerelease-branches branch March 1, 2025 00:01
@github-actions github-actions bot locked and limited conversation to collaborators Mar 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants