Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed Dec 22, 2024
1 parent 8cf3675 commit de8fb37
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
max-parallel: 8
fail-fast: false
matrix:
redis-image: [ "redis:6.2.14", "redis:7.4.1", "redislabs/redis:7.8.4-18" ]
python-version: [ "3.9", "3.11", "3.12", "3.13" ]
redis-image: [ "redis:6.2.16", "redis:7.4.1" ]
python-version: [ "3.9", "3.12", "3.13" ]
redis-py: [ "4.3.6", "4.6.0", "5.0.8", "5.2.1", "5.3.0b3" ]
include:
- python-version: "3.12"
Expand Down
10 changes: 6 additions & 4 deletions fakeredis/commands_mixins/hash_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,23 +233,25 @@ def hpersist(self, key: CommandItem, *args: bytes) -> List[int]:
res.append(-1)
return res

@command(name="HEXPIRETIME", fixed=(Key(Hash),), repeat=(bytes,), flags=msgs.FLAG_DO_NOT_CREATE)
@command(
name="HEXPIRETIME", fixed=(Key(Hash),), repeat=(bytes,), flags=msgs.FLAG_DO_NOT_CREATE, server_types=("redis",)
)
def hexpiretime(self, key: CommandItem, *args: bytes) -> List[int]:
res = self._get_expireat(b"HEXPIRETIME", key, *args)
return [(i // 1000 if i > 0 else i) for i in res]

@command(name="HPEXPIRETIME", fixed=(Key(Hash),), repeat=(bytes,))
@command(name="HPEXPIRETIME", fixed=(Key(Hash),), repeat=(bytes,), server_types=("redis",))
def hpexpiretime(self, key: CommandItem, *args: bytes) -> List[float]:
res = self._get_expireat(b"HEXPIRETIME", key, *args)
return res

@command(name="HTTL", fixed=(Key(Hash),), repeat=(bytes,))
@command(name="HTTL", fixed=(Key(Hash),), repeat=(bytes,), server_types=("redis",))
def httl(self, key: CommandItem, *args: bytes) -> List[int]:
curr_expireat_ms = self._get_expireat(b"HEXPIRETIME", key, *args)
curr_time_ms = current_time()
return [((i - curr_time_ms) // 1000) if i > 0 else i for i in curr_expireat_ms]

@command(name="HPTTL", fixed=(Key(Hash),), repeat=(bytes,))
@command(name="HPTTL", fixed=(Key(Hash),), repeat=(bytes,), server_types=("redis",))
def hpttl(self, key: CommandItem, *args: bytes) -> List[int]:
curr_expireat_ms = self._get_expireat(b"HEXPIRETIME", key, *args)
curr_time_ms = current_time()
Expand Down
2 changes: 2 additions & 0 deletions fakeredis/model/_command_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
from typing import Optional, Dict, List, Any, Union

from fakeredis._commands import SUPPORTED_COMMANDS

_COMMAND_INFO: Optional[Dict[bytes, List[Any]]] = None


Expand Down
1 change: 0 additions & 1 deletion test/test_mixins/test_acl_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
pytestmark.extend([pytest.mark.min_server("7"), testtools.run_test_if_redispy_ver("gte", "5")])


@fake_only
def test_acl_cat(r: redis.Redis):
categories = get_categories()
categories = [cat.decode() for cat in categories]
Expand Down

0 comments on commit de8fb37

Please sign in to comment.