You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'''test_redis_storage.py'''importpytestfromosimportgetenv, environfrompytest_docker_toolsimportcontainerredis=container(
name="test-redis",
image="redis/redis-stack:7.2.0-v13",
ports={6379: 16379, 8001: 18001},
)
environ["REDIS_OM_URL"] =f"redis://localhost:16379/0"fromgreenflow.redis_storageimportExperiment, ExperimentMetadata, ExpStorage@pytest.fixturedefstorage(redis):
fromredis_omimportget_redis_connection"""Fixture for ExpStorage instance"""# Migrator().run()redis=get_redis_connection(url=getenv("REDIS_OM_URL"))
load_gin(exp_name="test-platform", test=True)
storage=ExpStorage()
yieldstorage# Cleanup: Delete all keys after each testredis.flushdb()
classTestExpStorage:
deftest_find_experiments_by_name(self, storage):
fromredis_omimportMigrator"""Test finding experiments by name"""# Create multiple experimentsexp1=Experiment(exp_name="test1")
exp1.save()
exp2=Experiment(exp_name="test2")
exp2.save()
Migrator().run()
results=Experiment.find(Experiment.exp_name=="test1").all()
assertlen(results) ==1
When the test runs (and fails), I can see that the redis instance does have correct keys inserted. However, the assertion always fails as an empty list is returned.
I believe this is because ExperimentMetadata is a JsonModel. In fact, I tried changing it to a Dict[str, Any] and it still doesn't work and returns an empty list
The text was updated successfully, but these errors were encountered:
Minimal example:
I believe this is because ExperimentMetadata is a
JsonModel
. In fact, I tried changing it to a Dict[str, Any] and it still doesn't work and returns an empty listThe text was updated successfully, but these errors were encountered: