From 8e99245cc08c393d816ccebd31833127a381b857 Mon Sep 17 00:00:00 2001 From: Jaroslav Rohel Date: Wed, 19 Feb 2025 07:23:47 +0100 Subject: [PATCH] Fix step `directory "{dirpath}" is empty` --- dnf-behave-tests/common/file.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dnf-behave-tests/common/file.py b/dnf-behave-tests/common/file.py index 2feb9fbf5..8ddaff2b0 100644 --- a/dnf-behave-tests/common/file.py +++ b/dnf-behave-tests/common/file.py @@ -76,7 +76,9 @@ def step_delete_directory(context, dirpath): @behave.step('directory "{dirpath}" is empty') def directory_is_empty(context, dirpath): full_path = prepend_installroot(context, dirpath) - return bool(os.listdir(full_path)) + found = os.listdir(full_path) + if len(found) > 0: + raise AssertionError('Directory "{}" contains: \n{}'.format(full_path, '\n'.join(found))) @behave.step('file "{filepath}" exists')