mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-24 10:54:04 +08:00
Fix backend tests on Windows (#6781)
* hotfix * testing * test * fix * fix * add changeset * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
ab143855a9
commit
a807ede818
5
.changeset/vast-kings-deny.md
Normal file
5
.changeset/vast-kings-deny.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
feat:Fix backend tests on Windows
|
@ -170,7 +170,7 @@ class FileExplorer(Component):
|
||||
def make_tree(files):
|
||||
tree = []
|
||||
for file in files:
|
||||
parts = file.split("/")
|
||||
parts = file.split(os.path.sep)
|
||||
make_node(parts, tree)
|
||||
return tree
|
||||
|
||||
|
@ -2138,16 +2138,18 @@ class TestGallery:
|
||||
|
||||
postprocessed_gallery = gallery.postprocess(
|
||||
[
|
||||
("test/test_files/foo.png", "foo_caption"),
|
||||
(str(Path("test/test_files/foo.png")), "foo_caption"),
|
||||
(Path("test/test_files/bar.png"), "bar_caption"),
|
||||
"test/test_files/baz.png",
|
||||
str(Path("test/test_files/baz.png")),
|
||||
Path("test/test_files/qux.png"),
|
||||
]
|
||||
).model_dump()
|
||||
|
||||
# Using str(Path(...)) to ensure that the test passes on all platforms
|
||||
assert postprocessed_gallery == [
|
||||
{
|
||||
"image": {
|
||||
"path": "test/test_files/foo.png",
|
||||
"path": str(Path("test") / "test_files" / "foo.png"),
|
||||
"orig_name": "foo.png",
|
||||
"mime_type": None,
|
||||
"size": None,
|
||||
@ -2157,7 +2159,7 @@ class TestGallery:
|
||||
},
|
||||
{
|
||||
"image": {
|
||||
"path": "test/test_files/bar.png",
|
||||
"path": str(Path("test") / "test_files" / "bar.png"),
|
||||
"orig_name": "bar.png",
|
||||
"mime_type": None,
|
||||
"size": None,
|
||||
@ -2167,7 +2169,7 @@ class TestGallery:
|
||||
},
|
||||
{
|
||||
"image": {
|
||||
"path": "test/test_files/baz.png",
|
||||
"path": str(Path("test") / "test_files" / "baz.png"),
|
||||
"orig_name": "baz.png",
|
||||
"mime_type": None,
|
||||
"size": None,
|
||||
@ -2177,7 +2179,7 @@ class TestGallery:
|
||||
},
|
||||
{
|
||||
"image": {
|
||||
"path": "test/test_files/qux.png",
|
||||
"path": str(Path("test") / "test_files" / "qux.png"),
|
||||
"orig_name": "qux.png",
|
||||
"mime_type": None,
|
||||
"size": None,
|
||||
|
Loading…
Reference in New Issue
Block a user