Skip to content

Conversation

@jogehl
Copy link

@jogehl jogehl commented Nov 7, 2025

Pull Request check-list

Adds tests and the command HSETEX

@mkmkme
Copy link
Collaborator

mkmkme commented Nov 8, 2025

Hey @jogehl,

Thanks a lot for your contribution, I appreciate that! Could you please force-push your commit with a signoff? We require all of the commits to be signed, so currently the DCO check fails on your PR. You can find the instructions of how to do that here

Copy link
Collaborator

@mkmkme mkmkme left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! Overall it looks great. I added some comments to improve it even further. Could you address them?

for key, value in mapping.items():
pieces.append(key)
pieces.append(value)
if items:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably checking for only one of key + value, mapping or items would be great

assert r.hsetex("a", mapping=mapping, ex=5) == 1
assert r.hget("a", "field1") == b"value1"
assert r.hget("a", "field2") == b"value2"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you also add some tests that would check at least EX and PX?

Copy link
Author

Choose a reason for hiding this comment

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

I have tried this but for this the command HTTL is not implemented yet. Maybe it should be worth to include also this command?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you could handle this, I would greatly appreciate it! :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you don't have time for this, you can ignore this for now. I can add the HTTL and add the corresponding tests later

@jogehl jogehl force-pushed the main branch 6 times, most recently from aa57f75 to 31cf622 Compare November 8, 2025 09:13
@mkmkme
Copy link
Collaborator

mkmkme commented Nov 8, 2025

Also I've just now realised you didn't provide an async version. Could you add it and the test for it as well? It will be mostly copy-paste

@jogehl
Copy link
Author

jogehl commented Nov 10, 2025

Also I've just now realised you didn't provide an async version. Could you add it and the test for it as well? It will be mostly copy-paste

where can I find the implementations for the async? I can't find the async version for the HashCommands.

@mkmkme
Copy link
Collaborator

mkmkme commented Nov 11, 2025

Also I've just now realised you didn't provide an async version. Could you add it and the test for it as well? It will be mostly copy-paste

where can I find the implementations for the async? I can't find the async version for the HashCommands.

AFAICS AsyncHashCommands is just set to be the same as HashCommands. There is a subtle difference, though. valkey-py has a tricky class hierarchy that effectively makes HashCommands use synchronous version of execute_command whilst AsyncHashCommands is using the async one.

TL;DR: could you add an async test to verify it works? Thanks!

Joshua added 4 commits November 12, 2025 16:43
Signed-off-by: Joshua <joshua.gehlen@fkie.fraunhofer.de>
Signed-off-by: Joshua <joshua.gehlen@fkie.fraunhofer.de>
Signed-off-by: Joshua <joshua.gehlen@fkie.fraunhofer.de>
Signed-off-by: Joshua <joshua.gehlen@fkie.fraunhofer.de>
@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 86.04651% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.26%. Comparing base (c291080) to head (d7d8d5a).

Files with missing lines Patch % Lines
valkey/commands/core.py 71.42% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #246      +/-   ##
==========================================
- Coverage   76.28%   76.26%   -0.02%     
==========================================
  Files         129      129              
  Lines       33906    33992      +86     
==========================================
+ Hits        25864    25923      +59     
- Misses       8042     8069      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Add support for HSETEX

3 participants