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

PR: Fix syntax in test_namespacebrowser.py for Python 3.8 and 3.9 #21333

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

jitseniesen
Copy link
Member

Description of Changes

  • Wrote at least one-line docstrings (for any new functions) N/A
  • Added unit test(s) covering the changes (if testable) N/A
  • Included a screenshot or animation (if affecting the UI, see Licecap) N/A

This is a follow-up for PR #21235 which included a test that does not work under Python 3.8, as noted in #21235 (comment). This was not picked up by the automatic tests because of #21322.

Specifically, the with (..., ...) syntax was introduced in Python 3.10. Before, multiple context managers were possible but it had to be written without parentheses. Thus, this PR replace the parentheses with backslashes so that the test code works in Python 3.8 and 3.9.

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: Jitse Niesen

The `with (..., ...)` syntax was introduced in Python 3.10.
Before, multiple context managers were possible but it had to be
written without parentheses. Thus, this commit introduces backslashes
so that the code works in Python 3.8 and 3.9.
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks @jitseniesen! I can confirm this fix allows our test suite to run on those Python versions (before it was not even starting due to a syntax error).

I'm going to merge this one and fix the failing tests in a follow-up PR.

@ccordoba12 ccordoba12 merged commit eb98ba5 into spyder-ide:master Sep 13, 2023
19 of 20 checks passed
@ccordoba12 ccordoba12 changed the title Fix syntax in test_namespacebrowser.py for Python 3.8 and 3.9 PR: Fix syntax in test_namespacebrowser.py for Python 3.8 and 3.9 Sep 13, 2023
@jitseniesen jitseniesen deleted the syntax-py38 branch September 14, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants