Skip to content

Conversation

@ejd
Copy link

@ejd ejd commented Jan 3, 2019

This pull request includes changes that enable using CloseableQueue under both Python 2 and Python 3. The changes to the CloseableQueue module itself are limited to import fixes and elimination of a DeprecationWarning. 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.

ejd added 3 commits January 2, 2019 23:21
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
@ejd
Copy link
Author

ejd commented Feb 11, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant