Skip to content

Commit b58cd90

Browse files
committed
fix test_set_path
1 parent 58d383f commit b58cd90

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_json.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,18 +1416,18 @@ def test_set_file(client):
14161416
@pytest.mark.redismod
14171417
def test_set_path(client):
14181418
import json
1419-
import os
14201419
import tempfile
14211420

14221421
root = tempfile.mkdtemp()
14231422
sub = tempfile.mkdtemp(dir=root)
1424-
ospointer, jsonfile = tempfile.mkstemp(suffix=".json", dir=sub)
1425-
ospointer2, nojsonfile = tempfile.mkstemp(dir=root)
1423+
jsonfile = tempfile.mktemp(suffix=".json", dir=sub)
1424+
nojsonfile = tempfile.mktemp(dir=root)
14261425

14271426
with open(jsonfile, "w+") as fp:
14281427
fp.write(json.dumps({"hello": "world"}))
14291428
open(nojsonfile, "a+").write("hello")
14301429

1431-
result = {"/private" + jsonfile: True, "/private" + nojsonfile: False}
1432-
assert client.json().set_path(Path.rootPath(), os.path.realpath(root)) == result
1433-
assert client.json().get("/private" + jsonfile.rsplit(".")[0]) == {"hello": "world"}
1430+
result = {jsonfile: True, nojsonfile: False}
1431+
print(result)
1432+
assert client.json().set_path(Path.rootPath(), root) == result
1433+
assert client.json().get(jsonfile.rsplit(".")[0]) == {"hello": "world"}

0 commit comments

Comments
 (0)