[PATCH 1/1] patman: fix class TestFunctional

Variable orig_dir cannot be used in the finally block if it has not be assigned outside of the try block.
tools/patman/func_test.py:523:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment)
tools/patman/func_test.py:691:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment)
Fixes: fd70986a62af ("patman: Add a test that uses gitpython") Fixes: be051c0c7741 ("patman: Detect missing upstream in CountCommitsToBranch") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- tools/patman/func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 42ac4ed77b..e3918497cf 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -489,8 +489,8 @@ complicated as possible''') # pylint: disable=E1101 self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE) control.setup() + orig_dir = os.getcwd() try: - orig_dir = os.getcwd() os.chdir(self.gitdir)
# Check that it can detect the current branch @@ -679,8 +679,8 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE)
# Check that it can detect the current branch + orig_dir = os.getcwd() try: - orig_dir = os.getcwd() os.chdir(self.gitdir) with self.assertRaises(ValueError) as exc: gitutil.count_commits_to_branch(None)

On Fri, 21 Apr 2023 at 06:07, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
Variable orig_dir cannot be used in the finally block if it has not be assigned outside of the try block.
tools/patman/func_test.py:523:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment)
tools/patman/func_test.py:691:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment)
Fixes: fd70986a62af ("patman: Add a test that uses gitpython") Fixes: be051c0c7741 ("patman: Detect missing upstream in CountCommitsToBranch") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
tools/patman/func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Fri, 21 Apr 2023 at 06:07, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
Variable orig_dir cannot be used in the finally block if it has not be assigned outside of the try block.
tools/patman/func_test.py:523:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment)
tools/patman/func_test.py:691:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment)
Fixes: fd70986a62af ("patman: Add a test that uses gitpython") Fixes: be051c0c7741 ("patman: Detect missing upstream in CountCommitsToBranch") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
tools/patman/func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!
participants (2)
-
Heinrich Schuchardt
-
Simon Glass