Open
Conversation
In `CloseableQueue.py`, the imports are now wrapped in a try/except block. The new Python 3 imports are done in the `try` clause and the original Python 2 imports are left intact under the `except` clause. To update the tests, used a [recent version of test_queue.py][1] as a reference to find out how the mainline copy evolved since the creation of CloseableQueue. I integrated the changes that allowed the test cases to run without crashing. [1]: https://github.com/python/cpython/blob/v3.7.2/Lib/test/test_queue.py
In `CloseableQueue.py`, replace `raise StopIteration` with `return`, since [these are equivalent][1]. The deprecation is related to [PEP 479][2]. In the tests, `assertEquals` and `assert_` were replaced with `assertEqual` and `assertTrue`, respectively. The old names were [deprecated in Python 3.2][3]. [1]: https://docs.python.org/2/reference/simple_stmts.html#the-return-statement [2]: https://www.python.org/dev/peps/pep-0479/ [3]: https://docs.python.org/3/library/unittest.html?highlight=unittest#deprecated-aliases
Author
|
If someone comes across this PR looking for Python 3 support, you can find my fork of this project on PyPI under the name CloseableQueue-py3: https://pypi.org/project/CloseableQueue-py3/. To the owner of this repo: thank you for creating CloseableQueue and for putting it on PyPI. The fork retains your name as the package author and the README includes links back to this repo. The package metadata for the fork lists me as the maintainer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request includes changes that enable using CloseableQueue under both Python 2 and Python 3. The changes to the
CloseableQueuemodule itself are limited to import fixes and elimination of aDeprecationWarning. The test changes bring the test cases in line with the most current version of the test suite. The changes are described in a little more detail under each commit.These changes were tested on Linux under Python 2.7.15, Python 3.6.0, and Python 3.7.2. All tests passed without warnings.
Tests were executed via
python setup.py test.