AssertionError: assert not True
+ where True = <function exists at 0x7f5fe2c03420>('/home/omero/workspace/OMERO-test-integration/data/ManagedRepository/3af60d32-dfd4-4f19-a02f-3415e92a88e5_3325/2026-07/11/')
+ where <function exists at 0x7f5fe2c03420> = <module 'posixpath' (frozen)>.exists
+ where <module 'posixpath' (frozen)> = os.path
Stack Trace
self = <test.integration.clitest.test_cleanse.TestCleanseFullAdmin object at 0x7f5f4d8f6890>
capsys = <_pytest.capture.CaptureFixture object at 0x7f5f4100b450>
def testCleanseNonsenseName(self, capsys):
"""
Test cleanse removes file on disk after OriginalFile
name was changed to nonsense and its Image was deleted
"""
# import image and retrieve the OriginalFile
# (orig_file), its name and path
image = self.import_fake_file()[0]
fileset = self.get_fileset([image])
params = omero.sys.ParametersI()
params.addId(fileset.getId())
q = ("select originalFile.path, originalFile.id "
"from FilesetEntry where fileset.id = :id")
queryService = self.root.sf.getQueryService()
result = queryService.projection(q, params, self.group_ctx)
path_in_mrepo = result[0][0].getValue()
orig_file_path = self.make_path(path_in_mrepo)
assert os.path.exists(orig_file_path)
orig_file_id = result[0][1].getValue()
orig_file = self.query.get("OriginalFile", orig_file_id)
orig_file_name = orig_file.getName().getValue()
orig_file_path_and_name = self.make_path(path_in_mrepo, orig_file_name)
assert os.path.isfile(orig_file_path_and_name)
# retrieve the logfile, its name and path
q = ("select o from FilesetJobLink l "
"join l.parent as fs join l.child as j "
"join j.originalFileLinks l2 join l2.child as o "
"where fs.id = :id and "
"o.mimetype = 'application/omero-log-file'")
logfile = queryService.findByQuery(q, params, self.group_ctx)
logfile_name = logfile.getName().getValue()
path_in_mrepo = logfile.getPath().getValue()
logfile_path = self.make_path(path_in_mrepo)
assert os.path.exists(logfile_path)
logfile_path_and_name = self.make_path(path_in_mrepo, logfile_name)
assert os.path.isfile(logfile_path_and_name)
# change the names of original_file and logfile to nonsense
name = "nonsensical"
update_service = self.root.sf.getUpdateService()
orig_file.setName(omero.rtypes.rstring(name))
update_service.saveAndReturnObject(orig_file, self.group_ctx)
logfile.setName(omero.rtypes.rstring(name))
update_service.saveAndReturnObject(logfile, self.group_ctx)
# run the cleanse command, which will not delete
# the files on disk
self.args += [self.data_dir]
self.cli.invoke(self.args, strict=True)
assert os.path.exists(orig_file_path)
assert os.path.isfile(orig_file_path_and_name)
assert os.path.exists(logfile_path)
assert os.path.isfile(logfile_path_and_name)
# delete the image, which will not delete
# the files on disk because of the nonsensical name
# of orig_file and logfile
command = Delete2(targetObjects={"Image": [image.id.val]})
handle = self.client.sf.submit(command)
self.wait_on_cmd(self.client, handle)
assert os.path.exists(orig_file_path)
assert os.path.isfile(orig_file_path_and_name)
assert os.path.exists(logfile_path)
assert os.path.isfile(logfile_path_and_name)
# run cleanse command again, which will now delete the
# files on disk, the original file, the logfile
# and their directories
self.cli.invoke(self.args, strict=True)
out, err = capsys.readouterr()
assert not os.path.exists(orig_file_path)
assert not os.path.isfile(orig_file_path_and_name)
> assert not os.path.exists(logfile_path)
E AssertionError: assert not True
E + where True = <function exists at 0x7f5fe2c03420>('/home/omero/workspace/OMERO-test-integration/data/ManagedRepository/3af60d32-dfd4-4f19-a02f-3415e92a88e5_3325/2026-07/11/')
E + where <function exists at 0x7f5fe2c03420> = <module 'posixpath' (frozen)>.exists
E + where <module 'posixpath' (frozen)> = os.path
test/integration/clitest/test_cleanse.py:155: AssertionError