send2trash icon indicating copy to clipboard operation
send2trash copied to clipboard

TestTopdirTrash.test_trash test fails on macOS

Open nieder opened this issue 6 years ago • 1 comments

On macOS, TestTopdirTrash.test_trash from v1.5.0 fails like this for pythons 27, 34-37.

$ PYTHONPATH=/sw/build.build/send2trash-py27-1.5.0-1/Send2Trash-1.5.0/build/lib /sw/bin/pytest-2.7 -v
======================================== test session starts =========================================
platform darwin -- Python 2.7.16, pytest-3.10.1, py-1.7.0, pluggy-0.7.1 -- /sw/bin/python2.7
cachedir: .pytest_cache
rootdir: /sw/build.build/send2trash-py27-1.5.0-1/Send2Trash-1.5.0, inifile:
plugins: mock-1.10.0
collected 9 items                                                                                    

tests/test_plat_other.py::TestHomeTrash::test_trash PASSED                                     [ 11%]
tests/test_plat_other.py::TestUnicodeTrash::test_trash_bytes PASSED                            [ 22%]
tests/test_plat_other.py::TestUnicodeTrash::test_trash_unicode PASSED                          [ 33%]
tests/test_plat_other.py::TestTopdirTrash::test_trash FAILED                                   [ 44%]
tests/test_plat_other.py::TestTopdirTrashFallback::test_trash PASSED                           [ 55%]
tests/test_plat_other.py::TestTopdirFailure::test_trash PASSED                                 [ 66%]
tests/test_plat_other.py::TestSymlink::test_trash PASSED                                       [ 77%]
tests/test_plat_win.py::TestLongPath::test_trash_file SKIPPED                                  [ 88%]
tests/test_plat_win.py::TestLongPath::test_trash_folder SKIPPED                                [100%]

============================================== FAILURES ==============================================
_____________________________________ TestTopdirTrash.test_trash _____________________________________

self = <tests.test_plat_other.TestTopdirTrash testMethod=test_trash>

    def test_trash(self):
        s2t(self.filePath)
        self.assertFalse(op.exists(self.filePath))
>       self.assertTrue(op.exists(op.join(self.trashDir, str(os.getuid()), 'files', self.fileName)))
E       AssertionError: False is not true

tests/test_plat_other.py:115: AssertionError
=========================== 1 failed, 6 passed, 2 skipped in 0.09 seconds ============================

@dhomeier

nieder avatar May 04 '19 21:05 nieder

Hi! I was browsing through the project issues and noticed this one about portability.

I went ahead and created this fix to help out.

Happy to contribute to the project!

Let me know if you need any changes or have feedback on the approach.

denini08 avatar Sep 24 '25 19:09 denini08