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

fix: Add support for Python 3.11 #329

Merged
merged 18 commits into from
Jan 5, 2023
Merged

Conversation

hroncok
Copy link
Contributor

@hroncok hroncok commented Jun 28, 2022

There are two changes:

Changes in the actual code:

Change in the tests only:

  • accessing other enum members via instance attributes is no longer possible
    • we access them via the class instead
    • we leave the original test in a try-except block

Some of the Python enum changes might get reverted,
see python/cpython#93910
But the fix is backwards compatible.

Fixes #326

@hroncok hroncok requested review from a team as code owners June 28, 2022 20:45
@google-cla
Copy link

google-cla bot commented Jun 28, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

There are two changes:

Changes in the actual code:

 - _member_names changed from a list to a dict in python/cpython#28907
    - we instance-check and remove by list-specific or dict-specific way

Change in the tests only:

 - accessing other enum members via instance attributes is no longer possible
    - we access them via the class instead
    - we leave the original test in a try-except block

Some of the Python enum changes might get reverted,
see python/cpython#93910
But the fix is backwards compatible.

Fixes googleapis#326
@hroncok
Copy link
Contributor Author

hroncok commented Jun 28, 2022

Some of your commit messages failed linting.

Feel free to reword that message however you see fit.

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

A link would be helpful for this.

@@ -49,7 +49,11 @@ def test_total_ordering_w_other_enum_type():

for item in enums_test.OtherEnum:
assert not to_compare == item
assert to_compare.SOME_VALUE != item
assert type(to_compare).SOME_VALUE != item

Choose a reason for hiding this comment

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

to_compare is already OneEnum.SOME_VALUE -- so what is the purpose of the indirect reference through itself? Can this part of the test just be dropped?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this entire assertion here seemed redundant to me as well, but I decided to keep testing what was tested.

Note that I am not available to fine-tune this into perfection, that's why I posted the patch in a comment initially as "this makes it pass" instead of opening a PR right away.

@parthea
Copy link
Contributor

parthea commented Jun 29, 2022

Thanks @hroncok! Please could you sign the CLA using the link below?


📝 If you are not currently covered under a CLA, please visit https://cla.developers.google.com/.

@hroncok
Copy link
Contributor Author

hroncok commented Jun 29, 2022

I'm pretty sure I've already once approved this as being part of Red Hat, but now I also signed as an individual.

@parthea parthea changed the title Adjust to enum changes in Python 3.11.0b3 fix: Adjust to enum changes to support Python 3.11.0b3 Jun 29, 2022
@conventional-commit-lint-gcf
Copy link

conventional-commit-lint-gcf bot commented Jun 29, 2022

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@parthea parthea changed the title fix: Adjust to enum changes to support Python 3.11.0b3 fix: Adjust enum to support Python 3.11.0b3 Jun 29, 2022
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 29, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 29, 2022
@parthea parthea added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Jun 29, 2022
@parthea
Copy link
Contributor

parthea commented Jun 29, 2022

The github actions checks appear to be stuck with Waiting for status to be reported. I'm going to try closing the PR and re-opening it.

@parthea parthea closed this Jun 29, 2022
@parthea parthea reopened this Jun 29, 2022
@parthea
Copy link
Contributor

parthea commented Jun 29, 2022

LGTM but let's wait for #327 to be merged so that checks are passing.

@parthea
Copy link
Contributor

parthea commented Jul 2, 2022

I'm going to try adding python 3.11.0-beta.3 to the tests to see if I can get the coverage check to pass

@parthea parthea closed this Jul 2, 2022
@parthea parthea reopened this Jul 2, 2022
@parthea parthea closed this Jul 2, 2022
@parthea parthea reopened this Jul 2, 2022
@parthea parthea self-assigned this Jan 5, 2023
@parthea parthea changed the title fix: Adjust enum to support Python 3.11.0b3 fix: Adjust enum to support Python 3.11 Jan 5, 2023
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@parthea parthea changed the title fix: Adjust enum to support Python 3.11 fix: Add support for Python 3.11 Jan 5, 2023
@parthea parthea closed this Jan 5, 2023
@parthea parthea reopened this Jan 5, 2023
@parthea parthea closed this Jan 5, 2023
@parthea parthea reopened this Jan 5, 2023
@parthea
Copy link
Contributor

parthea commented Jan 5, 2023

The github actions tests appear to be stuck. Closing and re-opening the PR didn't help. I'll try again tomorrow.

The github action failed to start due to a syntax error. It should be fixed now

@parthea parthea closed this Jan 5, 2023
@parthea parthea reopened this Jan 5, 2023
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 5, 2023
@parthea parthea merged commit 5cff3a0 into googleapis:main Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kokoro:force-run Add this label to force Kokoro to re-run the tests. kokoro:run Add this label to force Kokoro to re-run the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failures in Python 3.11.0b3
5 participants