From: Sandro Tosi <morph@debian.org>
Date: Mon, 11 Jun 2018 11:06:56 -0400
Subject: support_alternative_mysqld_implementation

---
 mysql-connector-python/tests/mysqld.py  | 6 +++---
 mysqlx-connector-python/tests/mysqld.py | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mysql-connector-python/tests/mysqld.py b/mysql-connector-python/tests/mysqld.py
index ff0233d..f5e7297 100644
--- a/mysql-connector-python/tests/mysqld.py
+++ b/mysql-connector-python/tests/mysqld.py
@@ -188,14 +188,14 @@ class MySQLServerBase:
             if self._sbindir:
                 break
             for afile in files:
-                if afile == EXEC_MYSQLD and os.access(os.path.join(root, afile), 0):
+                if afile == EXEC_MYSQLD and 'bin' in root and os.access(os.path.join(root, afile), 0):
                     self._sbindir = root
                     LOGGER.debug("Located {} in {}".format(EXEC_MYSQLD, self._sbindir))
                     try:
                         files_to_find.remove(EXEC_MYSQLD)
                     except ValueError:
                         pass
-                elif afile == EXEC_MYSQL and os.access(os.path.join(root, afile), 0):
+                elif afile == EXEC_MYSQL and 'bin' in root and os.access(os.path.join(root, afile), 0):
                     self._bindir = root
                     LOGGER.debug("Located {} in {}".format(EXEC_MYSQL, self._bindir))
                     try:
@@ -299,7 +299,7 @@ class MySQLServerBase:
 
         prc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
         verstr = str(prc.communicate()[0])
-        matches = re.match(r".*Ver (\d)\.(\d).(\d{1,2})-*(\S*).*", verstr)
+        matches = re.match(r".*Ver (\d{1,2})\.(\d).(\d{1,2})-*(\S*).*", verstr)
         if matches:
             matches_groups = matches.groups()
             ver = tuple([int(v) for v in matches_groups[0:-1]])
diff --git a/mysqlx-connector-python/tests/mysqld.py b/mysqlx-connector-python/tests/mysqld.py
index ff0233d..f5e7297 100644
--- a/mysqlx-connector-python/tests/mysqld.py
+++ b/mysqlx-connector-python/tests/mysqld.py
@@ -188,14 +188,14 @@ class MySQLServerBase:
             if self._sbindir:
                 break
             for afile in files:
-                if afile == EXEC_MYSQLD and os.access(os.path.join(root, afile), 0):
+                if afile == EXEC_MYSQLD and 'bin' in root and os.access(os.path.join(root, afile), 0):
                     self._sbindir = root
                     LOGGER.debug("Located {} in {}".format(EXEC_MYSQLD, self._sbindir))
                     try:
                         files_to_find.remove(EXEC_MYSQLD)
                     except ValueError:
                         pass
-                elif afile == EXEC_MYSQL and os.access(os.path.join(root, afile), 0):
+                elif afile == EXEC_MYSQL and 'bin' in root and os.access(os.path.join(root, afile), 0):
                     self._bindir = root
                     LOGGER.debug("Located {} in {}".format(EXEC_MYSQL, self._bindir))
                     try:
@@ -299,7 +299,7 @@ class MySQLServerBase:
 
         prc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
         verstr = str(prc.communicate()[0])
-        matches = re.match(r".*Ver (\d)\.(\d).(\d{1,2})-*(\S*).*", verstr)
+        matches = re.match(r".*Ver (\d{1,2})\.(\d).(\d{1,2})-*(\S*).*", verstr)
         if matches:
             matches_groups = matches.groups()
             ver = tuple([int(v) for v in matches_groups[0:-1]])
