1
0
mirror of https://github.com/arsenetar/send2trash.git synced 2026-01-22 14:41:40 +00:00

test: Update trash topdir test for cross-platform compatibility

This commit is contained in:
denini08
2025-09-24 15:26:49 -03:00
parent 9a2c5bc690
commit 1781b16fa8

View File

@@ -163,23 +163,28 @@ def test_trash_topdir(gen_ext_vol):
s2t(gen_ext_vol[2]) s2t(gen_ext_vol[2])
assert op.exists(gen_ext_vol[2]) is False assert op.exists(gen_ext_vol[2]) is False
assert op.exists(op.join(trash_dir, str(os.getuid()), "files", gen_ext_vol[1])) is True
assert ( if sys.platform == "darwin":
op.exists( # On macOS, we can only verify the file was removed from original location
op.join( pass
trash_dir, else:
str(os.getuid()), # Others platforms we can test
"info", assert op.exists(op.join(trash_dir, str(os.getuid()), "files", gen_ext_vol[1])) is True
gen_ext_vol[1] + INFO_SUFFIX, assert (
op.exists(
op.join(
trash_dir,
str(os.getuid()),
"info",
gen_ext_vol[1] + INFO_SUFFIX,
)
) )
is True
) )
is True
) cfg = ConfigParser()
# info relative path (if another test is added, with the same fileName/Path, cfg.read(op.join(trash_dir, str(os.getuid()), "info", gen_ext_vol[1] + INFO_SUFFIX))
# then it gets renamed etc.) assert (gen_ext_vol[1] == cfg.get("Trash Info", "Path", raw=True)) is True
cfg = ConfigParser()
cfg.read(op.join(trash_dir, str(os.getuid()), "info", gen_ext_vol[1] + INFO_SUFFIX))
assert (gen_ext_vol[1] == cfg.get("Trash Info", "Path", raw=True)) is True
def test_trash_topdir_fallback(gen_ext_vol): def test_trash_topdir_fallback(gen_ext_vol):