On Tue, Sep 28, 2021 at 11:21:52PM +0100, Jonathan Dowland wrote:
I've begun work on updating to 0.21.7.24. I've pushed my in-progress
work here:
<https://salsa.debian.org/debian/trash-cli/-/tree/jmtd-update-0.21.7.24>
I've resolved the test_bump issue (remove it) as well as the next
significant problem, which was the assumption that '/usr/bin/env python'
will launch a python3 interpreter. This will never be true in Debian.
I've patched that everywhere, I think. (Note: I was a little surprised
that I had to patch setup.py *and* the generated binaries, as "python3.9
setup.py clean" re-generates them)
A huge chunk of tests are failing still, I've attached a list to this
mail. Feel free to help try and figure out why!
--
👱🏻 Jonathan Dowland
✎ [email protected]
🔗 https://jmtd.net
=================================== FAILURES ===================================
___ TestDeletingExistingFile.test_a_trashinfo_file_should_have_been_created ____
self = <tests.test_trash_put_slow.TestDeletingExistingFile
testMethod=test_a_trashinfo_file_should_have_been_created>
def test_a_trashinfo_file_should_have_been_created(self):
> read_file(self.temp_dir / 'XDG_DATA_HOME/Trash/info/foo.trashinfo')
tests/test_trash_put_slow.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = '/tmp/tmpmkz9vn_y/XDG_DATA_HOME/Trash/info/foo.trashinfo'
def read_file(path):
> with open(path) as f:
E FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/tmpmkz9vn_y/XDG_DATA_HOME/Trash/info/foo.trashinfo'
trashcli/fs.py:82: FileNotFoundError
___________ TestDeletingExistingFile.test_it_should_remove_the_file ____________
self = <tests.test_trash_put_slow.TestDeletingExistingFile
testMethod=test_it_should_remove_the_file>
def test_it_should_remove_the_file(self):
> assert not file_exists(self.temp_dir / 'foo')
E AssertionError: assert not True
E + where True = file_exists(('/tmp/tmp2ce8sk36' / 'foo'))
E + where '/tmp/tmp2ce8sk36' =
<tests.test_trash_put_slow.TestDeletingExistingFile
testMethod=test_it_should_remove_the_file>.temp_dir
tests/test_trash_put_slow.py:44: AssertionError
_ Test_when_deleting_an_existing_file_in_verbose_mode.test_should_be_succesfull
_
self =
<tests.test_trash_put_slow.Test_when_deleting_an_existing_file_in_verbose_mode
testMethod=test_should_be_succesfull>
def test_should_be_succesfull(self):
> assert 0 == self.fixture.exit_code
E AssertionError: assert 0 == 2
E + where 2 = <tests.test_trash_put_slow.TrashPutFixture object at
0x7f7578f4f370>.exit_code
E + where <tests.test_trash_put_slow.TrashPutFixture object at
0x7f7578f4f370> =
<tests.test_trash_put_slow.Test_when_deleting_an_existing_file_in_verbose_mode
testMethod=test_should_be_succesfull>.fixture
tests/test_trash_put_slow.py:70: AssertionError
_
Test_when_deleting_an_existing_file_in_verbose_mode.test_should_tell_where_a_file_is_trashed
_
self =
<tests.test_trash_put_slow.Test_when_deleting_an_existing_file_in_verbose_mode
testMethod=test_should_tell_where_a_file_is_trashed>
def test_should_tell_where_a_file_is_trashed(self):
output = self.fixture.stderr.splitlines()
expected_line = "trash-put: '%s' trashed in %s/XDG_DATA_HOME/Trash" % \
(self.foo_file, self.fixture.temp_dir)
> assert (expected_line in output)
E AssertionError: assert "trash-put: '/tmp/tmptm9z736y/foo' trashed in
/tmp/tmptm9z736y/XDG_DATA_HOME/Trash" in ["python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory"]
tests/test_trash_put_slow.py:67: AssertionError
________ Test_when_fed_with_dot_arguments.test_dot_argument_is_skipped _________
self = <tests.test_trash_put_slow.Test_when_fed_with_dot_arguments
testMethod=test_dot_argument_is_skipped>
def test_dot_argument_is_skipped(self):
self.fixture.run_trashput(".")
# the dot directory shouldn't be operated, but a diagnostic message
# shall be written on stderr
> self.assertEqual("trash-put: cannot trash directory '.'\n",
self.fixture.stderr)
E AssertionError: "trash-put: cannot trash directory '.'\n" != "python3:
can't open file '/build/trash-cl[102 chars]ry\n"
E - trash-put: cannot trash directory '.'
E + python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
tests/test_trash_put_slow.py:99: AssertionError
_ Test_when_fed_with_dot_arguments.test_dot_argument_is_skipped_even_in_subdirs
_
self = <tests.test_trash_put_slow.Test_when_fed_with_dot_arguments
testMethod=test_dot_argument_is_skipped_even_in_subdirs>
def test_dot_argument_is_skipped_even_in_subdirs(self):
sandbox = MyPath.make_temp_dir()
self.fixture.run_trashput("%s/." % sandbox)
# the dot directory shouldn't be operated, but a diagnostic message
# shall be writtend on stderr
> self.assertEqual("trash-put: cannot trash '.' directory '%s/.'\n" %
sandbox,
self.fixture.stderr)
E AssertionError: "trash-put: cannot trash '.' directory '/t[15
chars].'\n" != "python3: can't open file '/build/trash-cl[102 chars]ry\n"
E - trash-put: cannot trash '.' directory '/tmp/tmp8lfflw9o/.'
E + python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
tests/test_trash_put_slow.py:118: AssertionError
______ Test_when_fed_with_dot_arguments.test_dot_dot_argument_is_skipped _______
self = <tests.test_trash_put_slow.Test_when_fed_with_dot_arguments
testMethod=test_dot_dot_argument_is_skipped>
def test_dot_dot_argument_is_skipped(self):
self.fixture.run_trashput("..")
# the dot directory shouldn't be operated, but a diagnostic message
# shall be writtend on stderr
> self.assertEqual("trash-put: cannot trash directory '..'\n",
self.fixture.stderr)
E AssertionError: "trash-put: cannot trash directory '..'\n" != "python3:
can't open file '/build/trash-cl[102 chars]ry\n"
E - trash-put: cannot trash directory '..'
E + python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
tests/test_trash_put_slow.py:108: AssertionError
_
Test_when_fed_with_dot_arguments.test_dot_dot_argument_is_skipped_even_in_subdirs
_
self = <tests.test_trash_put_slow.Test_when_fed_with_dot_arguments
testMethod=test_dot_dot_argument_is_skipped_even_in_subdirs>
def test_dot_dot_argument_is_skipped_even_in_subdirs(self):
sandbox = MyPath.make_temp_dir()
self.fixture.run_trashput("%s/.." % sandbox)
# the dot directory shouldn't be operated, but a diagnostic message
# shall be writtend on stderr
> self.assertEqual("trash-put: cannot trash '..' directory '%s/..'\n" %
sandbox,
self.fixture.stderr)
E AssertionError: "trash-put: cannot trash '..' directory '/[17
chars].'\n" != "python3: can't open file '/build/trash-cl[102 chars]ry\n"
E - trash-put: cannot trash '..' directory '/tmp/tmpe22pmuqj/..'
E + python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
tests/test_trash_put_slow.py:132: AssertionError
_____________ TestUnsecureTrashDirMessages.test_when_is_a_symlink ______________
self = <tests.test_trash_put_slow.TestUnsecureTrashDirMessages
testMethod=test_when_is_a_symlink>
def test_when_is_a_symlink(self):
make_sticky_dir( self.fake_vol / 'link-destination')
os.symlink('link-destination', self.fake_vol / '.Trash')
self.fixture.run_trashput('--force-volume', self.fake_vol,
'-v', self.fake_vol / 'foo')
> assert_line_in_text(
'trash-put: found unsecure .Trash dir (should not be a
symlink): ' +
self.fake_vol / '.Trash', self.fixture.stderr)
tests/test_trash_put_slow.py:178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
line = 'trash-put: found unsecure .Trash dir (should not be a symlink):
/tmp/tmpjvxrmbia/fake-vol/.Trash'
text = "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n"
def assert_line_in_text(line, text):
> assert line in text.splitlines(), dedent('''\
Line not found in text
Line:
%s
Text:
---
%s---''') % (repr(line), text)
E AssertionError: Line not found in text
E Line:
E
E 'trash-put: found unsecure .Trash dir (should not be a symlink):
/tmp/tmpjvxrmbia/fake-vol/.Trash'
E
E Text:
E
E ---
E python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
E ---
tests/asserts.py:7: AssertionError
______________ TestUnsecureTrashDirMessages.test_when_is_unsticky ______________
self = <tests.test_trash_put_slow.TestUnsecureTrashDirMessages
testMethod=test_when_is_unsticky>
def test_when_is_unsticky(self):
require_empty_dir(self.fake_vol / '.Trash')
self.fixture.run_trashput('--force-volume', self.fake_vol,
'-v',
self.fake_vol / 'foo')
> assert_line_in_text(
'trash-put: found unsecure .Trash dir (should be sticky): ' +
self.fake_vol / '.Trash', self.fixture.stderr)
tests/test_trash_put_slow.py:156:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
line = 'trash-put: found unsecure .Trash dir (should be sticky):
/tmp/tmpfhpgjcvs/fake-vol/.Trash'
text = "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n"
def assert_line_in_text(line, text):
> assert line in text.splitlines(), dedent('''\
Line not found in text
Line:
%s
Text:
---
%s---''') % (repr(line), text)
E AssertionError: Line not found in text
E Line:
E
E 'trash-put: found unsecure .Trash dir (should be sticky):
/tmp/tmpfhpgjcvs/fake-vol/.Trash'
E
E Text:
E
E ---
E python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
E ---
tests/asserts.py:7: AssertionError
____________ TestUnsecureTrashDirMessages.test_when_it_is_not_a_dir ____________
self = <tests.test_trash_put_slow.TestUnsecureTrashDirMessages
testMethod=test_when_it_is_not_a_dir>
def test_when_it_is_not_a_dir(self):
make_empty_file(self.fake_vol / '.Trash')
self.fixture.run_trashput('--force-volume', self.fake_vol,
'-v',
self.fake_vol / 'foo')
> assert_line_in_text(
'trash-put: found unusable .Trash dir (should be a dir): ' +
self.fake_vol / '.Trash', self.fixture.stderr)
tests/test_trash_put_slow.py:167:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
line = 'trash-put: found unusable .Trash dir (should be a dir):
/tmp/tmp08asbgt8/fake-vol/.Trash'
text = "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n"
def assert_line_in_text(line, text):
> assert line in text.splitlines(), dedent('''\
Line not found in text
Line:
%s
Text:
---
%s---''') % (repr(line), text)
E AssertionError: Line not found in text
E Line:
E
E 'trash-put: found unusable .Trash dir (should be a dir):
/tmp/tmp08asbgt8/fake-vol/.Trash'
E
E Text:
E
E ---
E python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
E ---
tests/asserts.py:7: AssertionError
_______________ TestScriptsSmoke.test_trash_put_touch_filesystem _______________
self = <tests.test_trash_rm_script.TestScriptsSmoke
testMethod=test_trash_put_touch_filesystem>
def test_trash_put_touch_filesystem(self):
self.run_script('trash-put', 'non-existent')
> assert ("trash-put: cannot trash non existent 'non-existent'\n" ==
self.stderr)
E AssertionError: assert "trash-put: c...n-existent'\n" ==
'/usr/bin/pyt...r directory\n'
E - /usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory
E + trash-put: cannot trash non existent 'non-existent'
tests/test_trash_rm_script.py:22: AssertionError
____________________ TestScriptsSmoke.test_trash_put_works _____________________
self = <tests.test_trash_rm_script.TestScriptsSmoke
testMethod=test_trash_put_works>
def test_trash_put_works(self):
self.run_script('trash-put')
> assert ("Usage: trash-put [OPTION]... FILE..." in
self.stderr.splitlines())
E AssertionError: assert 'Usage: trash-put [OPTION]... FILE...' in
["/usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory"]
E + where ["/usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory"] = <built-in method splitlines of str object at
0x7f7578ef8b90>()
E + where <built-in method splitlines of str object at
0x7f7578ef8b90> = "/usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n".splitlines
E + where "/usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n" = <tests.test_trash_rm_script.TestScriptsSmoke
testMethod=test_trash_put_works>.stderr
tests/test_trash_rm_script.py:17: AssertionError
_____________________ TestScriptsSmoke.test_trash_rm_works _____________________
self = <tests.test_trash_rm_script.TestScriptsSmoke
testMethod=test_trash_rm_works>
def test_trash_rm_works(self):
self.run_script('trash-rm')
> assert "Usage:" in self.stderr.splitlines()
E AssertionError: assert 'Usage:' in ["/usr/bin/python3.9: can't open
file '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-rm': [Errno 2] No such
file or directory"]
E + where ["/usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-rm': [Errno 2] No such file
or directory"] = <built-in method splitlines of str object at 0x7f7578ef8c60>()
E + where <built-in method splitlines of str object at
0x7f7578ef8c60> = "/usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-rm': [Errno 2] No such file
or directory\n".splitlines
E + where "/usr/bin/python3.9: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-rm': [Errno 2] No such file
or directory\n" = <tests.test_trash_rm_script.TestScriptsSmoke
testMethod=test_trash_rm_works>.stderr
tests/test_trash_rm_script.py:13: AssertionError
___________________________ TestEmptyEndToEnd.test_h ___________________________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEnd testMethod=test_h>
def test_h(self):
result = run_command.run_command(self.tmp_dir, "trash-empty",
['-h'])
> self.assertEqual(["""\
usage: trash-empty [-h] [--version] [--trash-dir TRASH_DIR] [days]
Purge trashed files.
positional arguments:
days
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--trash-dir TRASH_DIR
specify the trash directory to use
Report bugs to https://github.com/andreafrancia/trash-cli/issues
""", '', 0],
[result.stdout,
result.stderr,
result.exit_code])
E AssertionError: Lists differ: ["usage:
trash-empty [-h] [--version] [--t[386 chars]', 0] != ['', "python3: can't open
file '/build/tra[113 chars]", 2]
E
E First differing element 0:
E "usage: trash-empty [-h] [--version] [--t[378
chars]es\n"
E ''
E
E Diff is 711 characters long. Set self.maxDiff to
None to see it.
tests/empty/test_empty_end_to_end.py:41: AssertionError
_________________________ TestEmptyEndToEnd.test_help __________________________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEnd
testMethod=test_help>
def test_help(self):
result = run_command.run_command(self.tmp_dir, "trash-empty",
['--help'])
> self.assertEqual(["""\
usage: trash-empty [-h] [--version] [--trash-dir TRASH_DIR] [days]
Purge trashed files.
positional arguments:
days
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--trash-dir TRASH_DIR
specify the trash directory to use
Report bugs to https://github.com/andreafrancia/trash-cli/issues
""", '', 0],
[result.stdout,
result.stderr,
result.exit_code])
E AssertionError: Lists differ: ["usage:
trash-empty [-h] [--version] [--t[386 chars]', 0] != ['', "python3: can't open
file '/build/tra[113 chars]", 2]
E
E First differing element 0:
E "usage: trash-empty [-h] [--version] [--t[378
chars]es\n"
E ''
E
E Diff is 711 characters long. Set self.maxDiff to
None to see it.
tests/empty/test_empty_end_to_end.py:18: AssertionError
___________________ TestEmptyEndToEnd.test_on_invalid_option ___________________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEnd
testMethod=test_on_invalid_option>
def test_on_invalid_option(self):
result = run_command.run_command(self.tmp_dir, "trash-empty",
['--wrong-option'])
> self.assertEqual(['',
'usage: trash-empty [-h] [--version] [--trash-dir
TRASH_DIR] [days]\n'
'trash-empty: error: unrecognized arguments:
--wrong-option\n',
2],
result.all)
E AssertionError: Lists differ: ['', 'usage: trash-empty [-h] [--version]
[--t[88 chars]', 2] != ['', "python3: can't open file '/build/trash-c[109
chars]", 2]
E
E First differing element 1:
E 'usage: trash-empty [-h] [--version] [--t[84 chars]on\n'
E "python3: can't open file '/build/trash-c[105 chars]ry\n"
E
E ['',
E - 'usage: trash-empty [-h] [--version] [--trash-dir TRASH_DIR]
[days]\n'
E - 'trash-empty: error: unrecognized arguments: --wrong-option\n',
E + "python3: can't open file "
E + "'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': "
E + '[Errno 2] No such file or directory\n',
E 2]
tests/empty/test_empty_end_to_end.py:73: AssertionError
_____________________ TestEmptyEndToEnd.test_on_print_time _____________________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEnd
testMethod=test_on_print_time>
def test_on_print_time(self):
result = run_command.run_command(
self.tmp_dir, "trash-empty",
['--print-time'],
env={'TRASH_DATE': '1970-12-31T23:59:59'})
> self.assertEqual(['1970-12-31T23:59:59\n',
'',
0],
result.all)
E AssertionError: Lists differ: ['1970-12-31T23:59:59\n', '', 0] != ['',
"python3: can't open file '/build/tras[112 chars]", 2]
E
E First differing element 0:
E '1970-12-31T23:59:59\n'
E ''
E
E - ['1970-12-31T23:59:59\n', '', 0]
E + ['',
E + "python3: can't open file "
E + "'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': "
E + '[Errno 2] No such file or directory\n',
E + 2]
tests/empty/test_empty_end_to_end.py:85: AssertionError
______________ TestEmptyEndToEnd.test_on_trash_date_not_parsable _______________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEnd
testMethod=test_on_trash_date_not_parsable>
def test_on_trash_date_not_parsable(self):
result = run_command.run_command(
self.tmp_dir, "trash-empty",
['--print-time'],
env={'TRASH_DATE': 'not a valid date'})
> self.assertEqual(['trash-empty: invalid TRASH_DATE: not a valid date\n',
0],
[result.stderr, result.exit_code])
E AssertionError: Lists differ: ['trash-empty: invalid TRASH_DATE: not a
valid date\n', 0] != ["python3: can't open file '/build/trash-c[109 chars]", 2]
E
E First differing element 0:
E 'trash-empty: invalid TRASH_DATE: not a valid date\n'
E "python3: can't open file '/build/trash-c[105 chars]ry\n"
E
E - ['trash-empty: invalid TRASH_DATE: not a valid date\n', 0]
E + ["python3: can't open file "
E + "'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': "
E + '[Errno 2] No such file or directory\n',
E + 2]
tests/empty/test_empty_end_to_end.py:96: AssertionError
________________________ TestEmptyEndToEnd.test_version ________________________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEnd
testMethod=test_version>
def test_version(self):
result = run_command.run_command(self.tmp_dir, "trash-empty",
['--version'])
> self.assertEqual(['trash-empty %s\n' % trash.version, '', 0],
[result.stdout,
result.stderr,
result.exit_code])
E AssertionError: Lists differ: ['trash-empty 0.21.7.24\n', '', 0] !=
['', "python3: can't open file '/build/tras[112 chars]", 2]
E
E First differing element 0:
E 'trash-empty 0.21.7.24\n'
E ''
E
E - ['trash-empty 0.21.7.24\n', '', 0]
E + ['',
E + "python3: can't open file "
E + "'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': "
E + '[Errno 2] No such file or directory\n',
E + 2]
tests/empty/test_empty_end_to_end.py:64: AssertionError
_______ TestEmptyEndToEndWithTrashDir.test_non_trash_info_is_not_deleted _______
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEndWithTrashDir
testMethod=test_non_trash_info_is_not_deleted>
def test_non_trash_info_is_not_deleted(self):
make_file(self.trash_dir / 'info' / 'non-trashinfo')
result = run_command.run_command(self.tmp_dir, "trash-empty",
['--trash-dir', self.trash_dir])
> assert [result.all, list_trash_dir(self.trash_dir)] == \
[['', '', 0], ['info/non-trashinfo']]
E AssertionError: assert [['', "python...n-trashinfo']] == [['', '',
0],...n-trashinfo']]
E At index 0 diff: ['', "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': [Errno 2] No such
file or directory\n", 2] != ['', '', 0]
E Use -v to get the full diff
tests/empty/test_empty_end_to_end.py:142: AssertionError
____________ TestEmptyEndToEndWithTrashDir.test_orphan_are_deleted _____________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEndWithTrashDir
testMethod=test_orphan_are_deleted>
def test_orphan_are_deleted(self):
make_file(self.trash_dir / 'files' / 'orphan')
os.makedirs(self.trash_dir / 'files' / 'orphan dir')
result = run_command.run_command(self.tmp_dir, "trash-empty",
['--trash-dir', self.trash_dir])
> assert [result.all, list_trash_dir(self.trash_dir)] == \
[['', '', 0], []]
E AssertionError: assert [['', "python...iles/orphan']] == [['', '', 0],
[]]
E At index 0 diff: ['', "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': [Errno 2] No such
file or directory\n", 2] != ['', '', 0]
E Use -v to get the full diff
tests/empty/test_empty_end_to_end.py:152: AssertionError
_________________ TestEmptyEndToEndWithTrashDir.test_trash_dir _________________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEndWithTrashDir
testMethod=test_trash_dir>
def test_trash_dir(self):
self.fake_trash_dir.add_trashed_file('foo', '/foo', 'FOO')
result = run_command.run_command(self.tmp_dir, "trash-empty",
['--trash-dir', self.trash_dir])
> assert [result.all, list_trash_dir(self.trash_dir)] == \
[['', '', 0], []]
E AssertionError: assert [['', "python... 'files/foo']] == [['', '', 0],
[]]
E At index 0 diff: ['', "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': [Errno 2] No such
file or directory\n", 2] != ['', '', 0]
E Use -v to get the full diff
tests/empty/test_empty_end_to_end.py:122: AssertionError
_______________ TestEmptyEndToEndWithTrashDir.test_xdg_data_home _______________
self = <tests.empty.test_empty_end_to_end.TestEmptyEndToEndWithTrashDir
testMethod=test_xdg_data_home>
def test_xdg_data_home(self):
xdg_data_home = self.tmp_dir / 'xdg'
FakeTrashDir(xdg_data_home / 'Trash').add_trashed_file('foo', '/foo',
'FOO')
result = run_command.run_command(self.tmp_dir, "trash-empty",
[], env={'XDG_DATA_HOME':
xdg_data_home})
trash_dir = xdg_data_home / 'Trash'
> assert [result.all, list_trash_dir(trash_dir)] == \
[['', '', 0], []]
E AssertionError: assert [['', "python... 'files/foo']] == [['', '', 0],
[]]
E At index 0 diff: ['', "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': [Errno 2] No such
file or directory\n", 2] != ['', '', 0]
E Use -v to get the full diff
tests/empty/test_empty_end_to_end.py:133: AssertionError
_ TestEmptyEndToEndWithArgument.test_it_should_remove_files_older_than_N_days __
self =
<tests.empty.test_empty_end_to_end_with_argument.TestEmptyEndToEndWithArgument
testMethod=test_it_should_remove_files_older_than_N_days>
def test_it_should_remove_files_older_than_N_days(self):
self.fake_trash_dir.add_trashinfo_with_date('foo', datetime.date(1999,
1, 1))
self.set_clock_at('2000-01-01')
self.user_run_trash_empty(['2'])
> assert list_trash_dir(self.trash_dir) == []
E AssertionError: assert ['info/foo.trashinfo'] == []
E Left contains one more item: 'info/foo.trashinfo'
E Use -v to get the full diff
tests/empty/test_empty_end_to_end_with_argument.py:48: AssertionError
_________________ TestEmptyEndToEndWithArgument.test_set_clock _________________
self =
<tests.empty.test_empty_end_to_end_with_argument.TestEmptyEndToEndWithArgument
testMethod=test_set_clock>
def test_set_clock(self):
self.set_clock_at('2000-01-01')
result = self.user_run_trash_empty(['--print-time'])
> self.assertEqual(['2000-01-01T00:00:00\n', '', 0], result.all)
E AssertionError: Lists differ: ['2000-01-01T00:00:00\n', '', 0] != ['',
"python3: can't open file '/build/tras[112 chars]", 2]
E
E First differing element 0:
E '2000-01-01T00:00:00\n'
E ''
E
E - ['2000-01-01T00:00:00\n', '', 0]
E + ['',
E + "python3: can't open file "
E + "'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-empty': "
E + '[Errno 2] No such file or directory\n',
E + 2]
tests/empty/test_empty_end_to_end_with_argument.py:32: AssertionError
__________________________ TestEndToEndList.test_help __________________________
self = <tests.list.test_end_to_end_list.TestEndToEndList testMethod=test_help>
def test_help(self):
result = run_command.run_command(self.tmp_dir, "trash-list",
['--help'])
> self.assertEqual("""\
usage: trash-list [-h] [--version] [--trash-dir TRASH_DIRS]
List trashed files
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--trash-dir TRASH_DIRS
specify the trash directory to use
Report bugs to https://github.com/andreafrancia/trash-cli/issues
""", result.stdout)
E AssertionError: "usage: trash-list [-h] [--version] [--tr[337 chars]es\n"
!= ''
E - usage: trash-list [-h] [--version] [--trash-dir TRASH_DIRS]
E -
E - List trashed files
E -
E - optional arguments:
E - -h, --help show this help message and exit
E - --version show program's version number and exit
E - --trash-dir TRASH_DIRS
E - specify the trash directory to use
E -
E - Report bugs to https://github.com/andreafrancia/trash-cli/issues
tests/list/test_end_to_end_list.py:46: AssertionError
__________________________ TestEndToEndList.test_list __________________________
self = <tests.list.test_end_to_end_list.TestEndToEndList testMethod=test_list>
def test_list(self):
self.fake_trash_dir.add_trashinfo2("/file1", datetime.datetime(2000, 1,
1, 0, 0, 1))
self.fake_trash_dir.add_trashinfo2("/file2", datetime.datetime(2000, 1,
1, 0, 0, 1))
result = run_command.run_command(self.tmp_dir, "trash-list",
['--trash-dir', self.trash_dir])
> assert [
'2000-01-01 00:00:01 /file1',
'2000-01-01 00:00:01 /file2',
] == sorted(result.stdout.splitlines())
E AssertionError: assert ['2000-01-01 ...00:01 /file2'] == []
E Left contains 2 more items, first extra item: '2000-01-01 00:00:01
/file1'
E Use -v to get the full diff
tests/list/test_end_to_end_list.py:25: AssertionError
____________________ TestEndToEndList.test_list_with_paths _____________________
self = <tests.list.test_end_to_end_list.TestEndToEndList
testMethod=test_list_with_paths>
def test_list_with_paths(self):
self.fake_trash_dir.add_trashinfo3("base1", "/file1",
datetime.datetime(2000, 1, 1, 0, 0, 1))
self.fake_trash_dir.add_trashinfo3("base2", "/file2",
datetime.datetime(2000, 1, 1, 0, 0, 1))
result = run_command.run_command(self.tmp_dir, "trash-list",
['--trash-dir', self.trash_dir,
'--files'])
> assert ('', [
'2000-01-01 00:00:01 /file1 -> %s/files/base1' % self.trash_dir,
'2000-01-01 00:00:01 /file2 -> %s/files/base2' % self.trash_dir,
]) == (result.stderr, sorted(result.stdout.splitlines()))
E AssertionError: assert ('', ['2000-0...files/base2']) == ("python3:
ca...ectory\n", [])
E At index 0 diff: '' != "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-list': [Errno 2] No such
file or directory\n"
E Use -v to get the full diff
tests/list/test_end_to_end_list.py:38: AssertionError
__________ TestEndToEndPut.test_it_should_print_usage_on_no_argument ___________
self = <tests.put.test_end_to_end_put.TestEndToEndPut
testMethod=test_it_should_print_usage_on_no_argument>
def test_it_should_print_usage_on_no_argument(self):
result = run_command.run_command(self.tmp_dir, "trash-put", [])
> assert [result.stdout, result.stderr, result.exit_code] == \
['', 'Usage: trash-put [OPTION]... FILE...\n'
'\n'
'trash-put: error: Please specify the files to trash.\n', 2]
E AssertionError: assert ['', "python3...rectory\n", 2] == ['', 'Usage:
... trash.\n', 2]
E At index 1 diff: "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n" != 'Usage: trash-put [OPTION]... FILE...\n\ntrash-put:
error: Please specify the files to trash.\n'
E Use -v to get the full diff
tests/put/test_end_to_end_put.py:82: AssertionError
________________ TestEndToEndPut.test_it_should_skip_dot_entry _________________
self = <tests.put.test_end_to_end_put.TestEndToEndPut
testMethod=test_it_should_skip_dot_entry>
def test_it_should_skip_dot_entry(self):
result = run_command.run_command(self.tmp_dir, "trash-put", ['.'])
> assert [result.stderr, result.exit_code] == \
["trash-put: cannot trash directory '.'\n", 0]
E AssertionError: assert ["python3: ca...rectory\n", 2] == ["trash-put:
...ory '.'\n", 0]
E At index 0 diff: "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n" != "trash-put: cannot trash directory '.'\n"
E Use -v to get the full diff
tests/put/test_end_to_end_put.py:70: AssertionError
_______________ TestEndToEndPut.test_it_should_skip_dotdot_entry _______________
self = <tests.put.test_end_to_end_put.TestEndToEndPut
testMethod=test_it_should_skip_dotdot_entry>
def test_it_should_skip_dotdot_entry(self):
result = run_command.run_command(self.tmp_dir, "trash-put", ['..'])
> assert [result.stderr, result.exit_code] == \
["trash-put: cannot trash directory '..'\n", 0]
E AssertionError: assert ["python3: ca...rectory\n", 2] == ["trash-put:
...ry '..'\n", 0]
E At index 0 diff: "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n" != "trash-put: cannot trash directory '..'\n"
E Use -v to get the full diff
tests/put/test_end_to_end_put.py:76: AssertionError
______________ TestEndToEndPut.test_it_should_skip_missing_files _______________
self = <tests.put.test_end_to_end_put.TestEndToEndPut
testMethod=test_it_should_skip_missing_files>
def test_it_should_skip_missing_files(self):
result = run_command.run_command(self.tmp_dir, "trash-put",
['-f', 'this_file_does_not_exist',
'nor_does_this_file'])
> assert [result.stdout, result.stderr, result.exit_code] == ['', '', 0]
E AssertionError: assert ['', "python3...rectory\n", 2] == ['', '', 0]
E At index 1 diff: "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory\n" != ''
E Use -v to get the full diff
tests/put/test_end_to_end_put.py:91: AssertionError
____________________ TestEndToEndPut.test_last_line_of_help ____________________
self = <tests.put.test_end_to_end_put.TestEndToEndPut
testMethod=test_last_line_of_help>
def test_last_line_of_help(self):
result = run_command.run_command(self.tmp_dir, "trash-put", ['--help'])
> assert last_line_of(result.stdout) == \
'Report bugs to
https://github.com/andreafrancia/trash-cli/issues'
E AssertionError: assert '' == 'Report bugs ...sh-cli/issues'
E - Report bugs to https://github.com/andreafrancia/trash-cli/issues
tests/put/test_end_to_end_put.py:20: AssertionError
_________________________ TestEndToEndPut.test_on_help _________________________
self = <tests.put.test_end_to_end_put.TestEndToEndPut testMethod=test_on_help>
def test_on_help(self):
result = run_command.run_command(self.tmp_dir, "trash-put", ['--help'])
> assert [result.stdout,
result.exit_code] == \
[dedent('''\
Usage: trash-put [OPTION]... FILE...
Put files in trash
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-d, --directory ignored (for GNU rm compatibility)
-f, --force silently ignore nonexistent files
-i, --interactive prompt before every removal
-r, -R, --recursive ignored (for GNU rm compatibility)
--trash-dir=TRASHDIR use TRASHDIR as trash folder
-v, --verbose explain what is being done
To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
trash -- -foo
trash ./-foo
Report bugs to https://github.com/andreafrancia/trash-cli/issues
'''), 0]
E AssertionError: assert ['', 2] == ['Usage: tras.../issues\n', 0]
E At index 0 diff: '' != "Usage: trash-put [OPTION]... FILE...\n\nPut
files in trash\n\nOptions:\n --version show program's version
number and exit\n -h, --help show this help message and exit\n -d,
--directory ignored (for GNU rm compatibility)\n -f, --force
silently ignore nonexistent files\n -i, --interactive prompt before every
removal\n -r, -R, --recursive ignored (for GNU rm compatibility)\n
--trash-dir=TRASHDIR use TRASHDIR as trash folder\n -v, --verbose
explain what is being done\n\nTo remove a file whose name starts with a ...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
tests/put/test_end_to_end_put.py:40: AssertionError
______________________ TestEndToEndPut.test_without_args _______________________
self = <tests.put.test_end_to_end_put.TestEndToEndPut
testMethod=test_without_args>
def test_without_args(self):
result = run_command.run_command(self.tmp_dir, "trash-put", [])
> assert [first_line_of(result.stderr),
result.exit_code] == \
['Usage: trash-put [OPTION]... FILE...', 2]
E AssertionError: assert ["python3: ca...directory", 2] == ['Usage:
tras.... FILE...', 2]
E At index 0 diff: "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory" != 'Usage: trash-put [OPTION]... FILE...'
E Use -v to get the full diff
tests/put/test_end_to_end_put.py:26: AssertionError
______________________ TestEndToEndPut.test_wrong_option _______________________
self = <tests.put.test_end_to_end_put.TestEndToEndPut
testMethod=test_wrong_option>
def test_wrong_option(self):
result = run_command.run_command(self.tmp_dir, "trash-put",
['--wrong-option'])
> assert [last_line_of(result.stderr),
result.exit_code] == \
['trash-put: error: no such option: --wrong-option', 2]
E AssertionError: assert ["python3: ca...directory", 2] == ['trash-put:
...ng-option', 2]
E At index 0 diff: "python3: can't open file
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9/build/trash-put': [Errno 2] No such
file or directory" != 'trash-put: error: no such option: --wrong-option'
E Use -v to get the full diff
tests/put/test_end_to_end_put.py:33: AssertionError
___________________ TestEndToEndRestore.test_no_file_trashed ___________________
self = <tests.restore.test_end_to_end_restore.TestEndToEndRestore
testMethod=test_no_file_trashed>
def test_no_file_trashed(self):
result = self.run_command("trash-restore")
> self.assertEqual("""\
No files trashed from current dir ('%s')
""" % self.curdir, result.stdout)
E AssertionError: "No files trashed from current dir
('/tmp/tmp371dzmnx/cwd')\n" != ''
E - No files trashed from current dir ('/tmp/tmp371dzmnx/cwd')
tests/restore/test_end_to_end_restore.py:27: AssertionError
_____________ TestEndToEndRestore.test_original_file_not_existing ______________
self = <tests.restore.test_end_to_end_restore.TestEndToEndRestore
testMethod=test_original_file_not_existing>
def test_original_file_not_existing(self):
self.fake_trash_dir.add_trashinfo3("foo", "/path",
datetime(2000,1,1,0,0,1))
result = self.run_command("trash-restore", ["/"], input='0')
> self.assertEqual("""\
0 2000-01-01 00:00:01 /path
What file to restore [0..0]: """,
result.stdout)
E AssertionError: ' 0 2000-01-01 00:00:01
/path\nWhat file to restore [0..0]: ' != ''
E - 0 2000-01-01 00:00:01 /path
E - What file to restore [0..0]:
tests/restore/test_end_to_end_restore.py:36: AssertionError
_________________ TestEndToEndRestore.test_restore_happy_path __________________
self = <tests.restore.test_end_to_end_restore.TestEndToEndRestore
testMethod=test_restore_happy_path>
def test_restore_happy_path(self):
self.fake_trash_dir.add_trashed_file(
"file1", pj(self.curdir, "path", "to", "file1"), "contents")
self.fake_trash_dir.add_trashed_file(
"file2", pj(self.curdir, "path", "to", "file2"), "contents")
self.assertEqual(True, file_exists(pj(self.trash_dir, "info",
"file2.trashinfo")))
self.assertEqual(True, file_exists(pj(self.trash_dir, "files",
"file2")))
result = self.run_command("trash-restore", ["/", '--sort=path'],
input='1')
> self.assertEqual("""\
0 2000-01-01 00:00:01 %(curdir)s/path/to/file1
1 2000-01-01 00:00:01 %(curdir)s/path/to/file2
What file to restore [0..1]: """ % { 'curdir': self.curdir},
result.stdout)
E AssertionError: ' 0 2000-01-01 00:00:01
/tmp/tmpnahxq343[106 chars]1]: ' != ''
E - 0 2000-01-01 00:00:01
/tmp/tmpnahxq343/cwd/path/to/file1
E - 1 2000-01-01 00:00:01
/tmp/tmpnahxq343/cwd/path/to/file2
E - What file to restore [0..1]:
tests/restore/test_end_to_end_restore.py:54: AssertionError
_____________ TestEndToEndRestore.test_restore_with_relative_path ______________
self = <tests.restore.test_end_to_end_restore.TestEndToEndRestore
testMethod=test_restore_with_relative_path>
def test_restore_with_relative_path(self):
self.fake_trash_dir.add_trashed_file(
"file1", pj(self.curdir, "path", "to", "file1"), "contents")
self.assertEqual(True, file_exists(pj(self.trash_dir, "info",
"file1.trashinfo")))
self.assertEqual(True, file_exists(pj(self.trash_dir, "files",
"file1")))
result = self.run_command("trash-restore",
["%(curdir)s" % {'curdir': "."},
'--sort=path'], input='0')
> self.assertEqual("""\
0 2000-01-01 00:00:01 %(curdir)s/path/to/file1
What file to restore [0..0]: """ % {'curdir': self.curdir},
result.stdout)
E AssertionError: ' 0 2000-01-01 00:00:01
/tmp/tmpzjd8o9us[45 chars]0]: ' != ''
E - 0 2000-01-01 00:00:01
/tmp/tmpzjd8o9us/cwd/path/to/file1
E - What file to restore [0..0]:
tests/restore/test_end_to_end_restore.py:74: AssertionError
=========================== short test summary info ============================
FAILED
tests/test_trash_put_slow.py::TestDeletingExistingFile::test_a_trashinfo_file_should_have_been_created
FAILED
tests/test_trash_put_slow.py::TestDeletingExistingFile::test_it_should_remove_the_file
FAILED
tests/test_trash_put_slow.py::Test_when_deleting_an_existing_file_in_verbose_mode::test_should_be_succesfull
FAILED
tests/test_trash_put_slow.py::Test_when_deleting_an_existing_file_in_verbose_mode::test_should_tell_where_a_file_is_trashed
FAILED
tests/test_trash_put_slow.py::Test_when_fed_with_dot_arguments::test_dot_argument_is_skipped
FAILED
tests/test_trash_put_slow.py::Test_when_fed_with_dot_arguments::test_dot_argument_is_skipped_even_in_subdirs
FAILED
tests/test_trash_put_slow.py::Test_when_fed_with_dot_arguments::test_dot_dot_argument_is_skipped
FAILED
tests/test_trash_put_slow.py::Test_when_fed_with_dot_arguments::test_dot_dot_argument_is_skipped_even_in_subdirs
FAILED
tests/test_trash_put_slow.py::TestUnsecureTrashDirMessages::test_when_is_a_symlink
FAILED
tests/test_trash_put_slow.py::TestUnsecureTrashDirMessages::test_when_is_unsticky
FAILED
tests/test_trash_put_slow.py::TestUnsecureTrashDirMessages::test_when_it_is_not_a_dir
FAILED
tests/test_trash_rm_script.py::TestScriptsSmoke::test_trash_put_touch_filesystem
FAILED tests/test_trash_rm_script.py::TestScriptsSmoke::test_trash_put_works
FAILED tests/test_trash_rm_script.py::TestScriptsSmoke::test_trash_rm_works
FAILED tests/empty/test_empty_end_to_end.py::TestEmptyEndToEnd::test_h - Asse...
FAILED tests/empty/test_empty_end_to_end.py::TestEmptyEndToEnd::test_help - A...
FAILED
tests/empty/test_empty_end_to_end.py::TestEmptyEndToEnd::test_on_invalid_option
FAILED
tests/empty/test_empty_end_to_end.py::TestEmptyEndToEnd::test_on_print_time
FAILED
tests/empty/test_empty_end_to_end.py::TestEmptyEndToEnd::test_on_trash_date_not_parsable
FAILED tests/empty/test_empty_end_to_end.py::TestEmptyEndToEnd::test_version
FAILED
tests/empty/test_empty_end_to_end.py::TestEmptyEndToEndWithTrashDir::test_non_trash_info_is_not_deleted
FAILED
tests/empty/test_empty_end_to_end.py::TestEmptyEndToEndWithTrashDir::test_orphan_are_deleted
FAILED
tests/empty/test_empty_end_to_end.py::TestEmptyEndToEndWithTrashDir::test_trash_dir
FAILED
tests/empty/test_empty_end_to_end.py::TestEmptyEndToEndWithTrashDir::test_xdg_data_home
FAILED
tests/empty/test_empty_end_to_end_with_argument.py::TestEmptyEndToEndWithArgument::test_it_should_remove_files_older_than_N_days
FAILED
tests/empty/test_empty_end_to_end_with_argument.py::TestEmptyEndToEndWithArgument::test_set_clock
FAILED tests/list/test_end_to_end_list.py::TestEndToEndList::test_help - Asse...
FAILED tests/list/test_end_to_end_list.py::TestEndToEndList::test_list - Asse...
FAILED
tests/list/test_end_to_end_list.py::TestEndToEndList::test_list_with_paths
FAILED
tests/put/test_end_to_end_put.py::TestEndToEndPut::test_it_should_print_usage_on_no_argument
FAILED
tests/put/test_end_to_end_put.py::TestEndToEndPut::test_it_should_skip_dot_entry
FAILED
tests/put/test_end_to_end_put.py::TestEndToEndPut::test_it_should_skip_dotdot_entry
FAILED
tests/put/test_end_to_end_put.py::TestEndToEndPut::test_it_should_skip_missing_files
FAILED tests/put/test_end_to_end_put.py::TestEndToEndPut::test_last_line_of_help
FAILED tests/put/test_end_to_end_put.py::TestEndToEndPut::test_on_help - Asse...
FAILED tests/put/test_end_to_end_put.py::TestEndToEndPut::test_without_args
FAILED tests/put/test_end_to_end_put.py::TestEndToEndPut::test_wrong_option
FAILED
tests/restore/test_end_to_end_restore.py::TestEndToEndRestore::test_no_file_trashed
FAILED
tests/restore/test_end_to_end_restore.py::TestEndToEndRestore::test_original_file_not_existing
FAILED
tests/restore/test_end_to_end_restore.py::TestEndToEndRestore::test_restore_happy_path
FAILED
tests/restore/test_end_to_end_restore.py::TestEndToEndRestore::test_restore_with_relative_path
======================== 41 failed, 222 passed in 0.97s ========================