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

LPOS: add new command #1354

Merged
merged 4 commits into from
Jul 22, 2020
Merged

LPOS: add new command #1354

merged 4 commits into from
Jul 22, 2020

Conversation

aparcar
Copy link
Contributor

@aparcar aparcar commented Jun 21, 2020

fix #1353

Pull Request check-list

Please make sure to review and check all of these items:

  • Does $ tox pass with this change (including linting)?
  • Does travis tests pass with this change (enable it first in your forked repo and wait for the travis build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Redis 6.0.6 will support a new command called LPOS

The command returns the index of matching elements inside a Redis list. By default, when no options are given, it will scan the list from head to tail, looking for the first match of "element". If the element is found, its index (the zero-based position in the list) is returned. Otherwise, if no match is found, NULL is returned.

This PR adds the command and tests

@aparcar
Copy link
Contributor Author

aparcar commented Jun 21, 2020

Does $ tox pass with this change (including linting)?

  py27-plain: commands succeeded
  py27-hiredis: commands succeeded
ERROR:  py35-plain: InterpreterNotFound: python3.5
ERROR:  py35-hiredis: InterpreterNotFound: python3.5
ERROR:  py36-plain: InterpreterNotFound: python3.6
ERROR:  py36-hiredis: InterpreterNotFound: python3.6
  py37-plain: commands succeeded
  py37-hiredis: commands succeeded
ERROR:  py38-plain: InterpreterNotFound: python3.8
ERROR:  py38-hiredis: InterpreterNotFound: python3.8
  py-plain: commands succeeded
  py-hiredis: commands succeeded
  py3-plain: commands succeeded
  py3-hiredis: commands succeeded
ERROR:  flake8: InterpreterNotFound: python3.6

It somewhat passes I guess.

@aparcar
Copy link
Contributor Author

aparcar commented Jun 21, 2020

Is the new or changed code fully tested?

I transferred the "official" redis tests, however no garbage inputs are tested. Is that required?

@aparcar
Copy link
Contributor Author

aparcar commented Jun 21, 2020

Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

I copied the "official" documentation and it's rendered with sphinx. Are any release news file updates required?

image

@aparcar
Copy link
Contributor Author

aparcar commented Jun 21, 2020

Does travis tests pass with this change (enable it first in your forked repo and wait for the travis build to finish)?

As Redis 6.0.6 isn't installed on the travis instance everything fails. Using Redis unstable branch should work for all Python versions.

@aparcar aparcar marked this pull request as ready for review June 22, 2020 07:58
@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2020

Codecov Report

Merging #1354 into master will decrease coverage by 7.28%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1354      +/-   ##
==========================================
- Coverage   92.76%   85.48%   -7.29%     
==========================================
  Files          20        7      -13     
  Lines        6581     3017    -3564     
==========================================
- Hits         6105     2579    -3526     
+ Misses        476      438      -38     
Impacted Files Coverage Δ
redis/client.py 85.99% <73.68%> (-0.09%) ⬇️
redis/connection.py 81.40% <100.00%> (-0.35%) ⬇️
redis/exceptions.py 100.00% <100.00%> (ø)
redis/_compat.py 86.99% <0.00%> (-0.11%) ⬇️
redis/lock.py 100.00% <0.00%> (ø)
tests/test_lock.py
tests/test_encoding.py
tests/test_connection.py
tests/test_monitor.py
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 75a2cfe...aa5a68b. Read the comment docs.

@RoeyPrat
Copy link

Let's wait until redis 6.0.6 is out, and the UT check that version, to review this.

@aparcar
Copy link
Contributor Author

aparcar commented Jul 20, 2020

Redis 6.0.6 is now available.

@andymccurdy
Copy link
Contributor

Just waiting on the official docker image for 6.0.6 to be released.

@aparcar
Copy link
Contributor Author

aparcar commented Jul 21, 2020

Related docker-library/official-images#8400

@aparcar
Copy link
Contributor Author

aparcar commented Jul 22, 2020

Seems to work fine now. I didn't touch any of the files which are mentioned in the codecov report...

@abrookins
Copy link
Contributor

To get coverage reported correctly, you'll need to bump the redis version used in this Dockerfile: https://github.com/andymccurdy/redis-py/blob/master/docker/base/Dockerfile

aparcar added 2 commits July 21, 2020 18:54
Signed-off-by: Paul Spooren <mail@aparcar.org>
fix redis#1353

Signed-off-by: Paul Spooren <mail@aparcar.org>
@andymccurdy
Copy link
Contributor

I don't know why codecov is complaining. I'm wondering if they don't have a great base after we changed how the coverage report is run in the docker PR. I'm going to merge this anyway as it's clear that this PR did not contribute to the lowering of the coverage percentage.

@andymccurdy andymccurdy merged commit f001927 into redis:master Jul 22, 2020
@aparcar
Copy link
Contributor Author

aparcar commented Jul 22, 2020

Thank you!

@aparcar aparcar deleted the lpos branch July 22, 2020 22:09
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.

Support for new LPOS command
5 participants