[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Apr 21 14:00:01 UTC 2023


The branch, master has been updated
       via  24dd45613a6 python:tests: Skip the source_chars test if not a git dir
      from  3c50a921aec s3:client: Remove unused tree.c

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 24dd45613a693e029ffc4055abe6ae735a092824
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 14 21:05:18 2023 +0200

    python:tests: Skip the source_chars test if not a git dir
    
    This test doesn't work in release tarballs. Skip it if git fails.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: David Mulder <dmulder at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Fri Apr 21 13:59:29 UTC 2023 on atb-devel-224

-----------------------------------------------------------------------

Summary of changes:
 python/samba/tests/source_chars.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/tests/source_chars.py b/python/samba/tests/source_chars.py
index 49733968e43..e0acb38b8f7 100644
--- a/python/samba/tests/source_chars.py
+++ b/python/samba/tests/source_chars.py
@@ -23,7 +23,7 @@ from collections import Counter
 from samba.colour import c_RED, c_GREEN, c_DARK_YELLOW, switch_colour_off
 import re
 import unicodedata as u
-from samba.tests import TestCase
+from samba.tests import TestCase, SkipTest
 
 if not sys.stdout.isatty():
     switch_colour_off()
@@ -35,10 +35,15 @@ def _find_root():
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            timeout=10)
-    except subprocess.SubprocessError as e:
-        print(c_RED(f"Error running git (is this a git tree?): {e}"))
-        print("This test is only useful in a git working tree")
-        sys.exit(1)
+    except subprocess.CalledProcessError as err:
+        print(c_RED("Error running git (is this a git tree?): %s" % (err)))
+
+        SkipTest("This test is only useful in a git working tree")
+        sys.exit(0)
+
+    if p.returncode != 0:
+        raise SkipTest("This test is only useful in a git working tree")
+        sys.exit(0)
 
     root = p.stdout.decode().strip()
 
@@ -54,8 +59,7 @@ def _find_root():
     return root
 
 
-ROOT = _find_root()
-
+ROOT = None
 
 IGNORED_FILES = (
     'examples/validchars/validchr.com',
@@ -202,6 +206,11 @@ def is_bad_char(c):
 
 
 class CharacterTests(TestCase):
+    def setUp(self):
+        global ROOT
+        if not ROOT:
+            ROOT = _find_root()
+
     def test_no_unexpected_format_chars(self):
         """This test tries to ensure that no source file has unicode control
         characters that can change the apparent order of other


-- 
Samba Shared Repository



More information about the samba-cvs mailing list