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()
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()
return root
-ROOT = _find_root()
-
+ROOT = None
IGNORED_FILES = (
'examples/validchars/validchr.com',
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