From c2372893ddd3134e9b572412f7170ffefa0d855187fd7e5279a6fbe01f1713c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 5 Jun 2020 10:18:24 +0000 Subject: [PATCH] Accepting request 811672 from home:pgajdos:python - test package with mariadb - added patches https://github.com/PyMySQL/PyMySQL/commit/a500fcd64d4500417540a2a2ff7b16a88d1872ad + python-PyMySQL-no-unittest2.patch OBS-URL: https://build.opensuse.org/request/show/811672 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyMySQL?expand=0&rev=21 --- PyMySQL-0.9.3.tar.gz | 4 +- python-PyMySQL-no-unittest2.patch | 485 ++++++++++++++++++++++++++++++ python-PyMySQL.changes | 8 + python-PyMySQL.spec | 38 ++- 4 files changed, 530 insertions(+), 5 deletions(-) create mode 100644 python-PyMySQL-no-unittest2.patch diff --git a/PyMySQL-0.9.3.tar.gz b/PyMySQL-0.9.3.tar.gz index bb7be3f..b007365 100644 --- a/PyMySQL-0.9.3.tar.gz +++ b/PyMySQL-0.9.3.tar.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8c059dcd81dedb85a9f034d5e22dcb4442c0b201908bede99e306d65ea7c8e7 -size 75293 +oid sha256:5a85599a69b51db185f9447ba5034501482496e481574bce972c7dcb5abe1d57 +size 86715 diff --git a/python-PyMySQL-no-unittest2.patch b/python-PyMySQL-no-unittest2.patch new file mode 100644 index 0000000..7bda504 --- /dev/null +++ b/python-PyMySQL-no-unittest2.patch @@ -0,0 +1,485 @@ +Index: PyMySQL-0.9.3/pymysql/tests/__init__.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/__init__.py 2018-06-27 09:28:18.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/__init__.py 2020-06-03 10:13:17.705278419 +0200 +@@ -14,5 +14,5 @@ from pymysql.tests.test_optionfile impor + from pymysql.tests.thirdparty import * + + if __name__ == "__main__": +- import unittest2 +- unittest2.main() ++ import unittest ++ unittest.main() +Index: PyMySQL-0.9.3/pymysql/tests/base.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/base.py 2018-12-17 13:00:21.000000000 +0100 ++++ PyMySQL-0.9.3/pymysql/tests/base.py 2020-06-03 10:13:17.705278419 +0200 +@@ -3,14 +3,33 @@ import json + import os + import re + import warnings +- +-import unittest2 ++import unittest + + import pymysql + from .._compat import CPYTHON + + +-class PyMySQLTestCase(unittest2.TestCase): ++if CPYTHON: ++ import atexit ++ gc.set_debug(gc.DEBUG_UNCOLLECTABLE) ++ ++ @atexit.register ++ def report_uncollectable(): ++ import gc ++ if not gc.garbage: ++ print("No garbages!") ++ return ++ print('uncollectable objects') ++ for obj in gc.garbage: ++ print(obj) ++ if hasattr(obj, '__dict__'): ++ print(obj.__dict__) ++ for ref in gc.get_referrers(obj): ++ print("referrer:", ref) ++ print('---') ++ ++ ++class PyMySQLTestCase(unittest.TestCase): + # You can specify your test environment creating a file named + # "databases.json" or editing the `databases` variable below. + fname = os.path.join(os.path.dirname(__file__), "databases.json") +@@ -97,7 +116,6 @@ class PyMySQLTestCase(unittest2.TestCase + """Ensure cycles are collected via gc. + + Runs additional times on non-CPython platforms. +- + """ + gc.collect() + if not CPYTHON: +Index: PyMySQL-0.9.3/pymysql/tests/test_basic.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/test_basic.py 2018-12-18 10:58:59.000000000 +0100 ++++ PyMySQL-0.9.3/pymysql/tests/test_basic.py 2020-06-03 10:13:17.705278419 +0200 +@@ -4,7 +4,7 @@ import json + import time + import warnings + +-from unittest2 import SkipTest ++import pytest + + from pymysql import util + import pymysql.cursors +@@ -143,7 +143,7 @@ class TestConversion(base.PyMySQLTestCas + + conn = self.connect() + if not self.mysql_server_is(conn, (5, 6, 4)): +- raise SkipTest("target backend does not support microseconds") ++ pytest.skip("target backend does not support microseconds") + c = conn.cursor() + dt = datetime.datetime(2013, 11, 12, 9, 9, 9, 123450) + c.execute("create table test_datetime (id int, ts datetime(6))") +@@ -256,7 +256,7 @@ class TestCursor(base.PyMySQLTestCase): + args["charset"] = "utf8mb4" + conn = pymysql.connect(**args) + if not self.mysql_server_is(conn, (5, 7, 0)): +- raise SkipTest("JSON type is not supported on MySQL <= 5.6") ++ pytest.skip("JSON type is not supported on MySQL <= 5.6") + + self.safe_create_table(conn, "test_json", """\ + create table test_json ( +Index: PyMySQL-0.9.3/pymysql/tests/test_connection.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/test_connection.py 2018-12-18 10:58:59.000000000 +0100 ++++ PyMySQL-0.9.3/pymysql/tests/test_connection.py 2020-06-03 10:13:17.705278419 +0200 +@@ -1,7 +1,7 @@ + import datetime + import sys + import time +-import unittest2 ++import pytest + import pymysql + from pymysql.tests import base + from pymysql._compat import text_type +@@ -100,14 +100,14 @@ class TestAuthentication(base.PyMySQLTes + def test_plugin(self): + conn = self.connect() + if not self.mysql_server_is(conn, (5, 5, 0)): +- raise unittest2.SkipTest("MySQL-5.5 required for plugins") ++ pytest.skip("MySQL-5.5 required for plugins") + cur = conn.cursor() + cur.execute("select plugin from mysql.user where concat(user, '@', host)=current_user()") + for r in cur: + self.assertIn(conn._auth_plugin_name, (r[0], 'mysql_native_password')) + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipIf(socket_found, "socket plugin already installed") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(socket_found, reason="socket plugin already installed") + def testSocketAuthInstallPlugin(self): + # needs plugin. lets install it. + cur = self.connect().cursor() +@@ -124,13 +124,13 @@ class TestAuthentication(base.PyMySQLTes + self.realtestSocketAuth() + except pymysql.err.InternalError: + TestAuthentication.socket_found = False +- raise unittest2.SkipTest('we couldn\'t install the socket plugin') ++ pytest.skip('we couldn\'t install the socket plugin') + finally: + if TestAuthentication.socket_found: + cur.execute("uninstall plugin %s" % self.socket_plugin_name) + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipUnless(socket_found, "no socket plugin") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(not socket_found, reason="no socket plugin") + def testSocketAuth(self): + self.realtestSocketAuth() + +@@ -179,8 +179,8 @@ class TestAuthentication(base.PyMySQLTes + self.con=con + + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipIf(two_questions_found, "two_questions plugin already installed") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(two_questions_found, reason="two_questions plugin already installed") + def testDialogAuthTwoQuestionsInstallPlugin(self): + # needs plugin. lets install it. + cur = self.connect().cursor() +@@ -189,13 +189,13 @@ class TestAuthentication(base.PyMySQLTes + TestAuthentication.two_questions_found = True + self.realTestDialogAuthTwoQuestions() + except pymysql.err.InternalError: +- raise unittest2.SkipTest('we couldn\'t install the two_questions plugin') ++ pytest.skip('we couldn\'t install the two_questions plugin') + finally: + if TestAuthentication.two_questions_found: + cur.execute("uninstall plugin two_questions") + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipUnless(two_questions_found, "no two questions auth plugin") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(not two_questions_found, reason="no two questions auth plugin") + def testDialogAuthTwoQuestions(self): + self.realTestDialogAuthTwoQuestions() + +@@ -209,8 +209,8 @@ class TestAuthentication(base.PyMySQLTes + pymysql.connect(user='pymysql_2q', **self.db) + pymysql.connect(user='pymysql_2q', auth_plugin_map={b'dialog': TestAuthentication.Dialog}, **self.db) + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipIf(three_attempts_found, "three_attempts plugin already installed") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(three_attempts_found, reason="three_attempts plugin already installed") + def testDialogAuthThreeAttemptsQuestionsInstallPlugin(self): + # needs plugin. lets install it. + cur = self.connect().cursor() +@@ -219,13 +219,13 @@ class TestAuthentication(base.PyMySQLTes + TestAuthentication.three_attempts_found = True + self.realTestDialogAuthThreeAttempts() + except pymysql.err.InternalError: +- raise unittest2.SkipTest('we couldn\'t install the three_attempts plugin') ++ pytest.skip('we couldn\'t install the three_attempts plugin') + finally: + if TestAuthentication.three_attempts_found: + cur.execute("uninstall plugin three_attempts") + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipUnless(three_attempts_found, "no three attempts plugin") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(not three_attempts_found, reason="no three attempts plugin") + def testDialogAuthThreeAttempts(self): + self.realTestDialogAuthThreeAttempts() + +@@ -250,10 +250,10 @@ class TestAuthentication(base.PyMySQLTes + with self.assertRaises(pymysql.err.OperationalError): + pymysql.connect(user='pymysql_3a', auth_plugin_map={b'dialog': TestAuthentication.Dialog}, **self.db) + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipIf(pam_found, "pam plugin already installed") +- @unittest2.skipIf(os.environ.get('PASSWORD') is None, "PASSWORD env var required") +- @unittest2.skipIf(os.environ.get('PAMSERVICE') is None, "PAMSERVICE env var required") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(pam_found, reason="pam plugin already installed") ++ @pytest.mark.skipif(os.environ.get('PASSWORD') is None, reason="PASSWORD env var required") ++ @pytest.mark.skipif(os.environ.get('PAMSERVICE') is None, reason="PAMSERVICE env var required") + def testPamAuthInstallPlugin(self): + # needs plugin. lets install it. + cur = self.connect().cursor() +@@ -262,16 +262,16 @@ class TestAuthentication(base.PyMySQLTes + TestAuthentication.pam_found = True + self.realTestPamAuth() + except pymysql.err.InternalError: +- raise unittest2.SkipTest('we couldn\'t install the auth_pam plugin') ++ pytest.skip('we couldn\'t install the auth_pam plugin') + finally: + if TestAuthentication.pam_found: + cur.execute("uninstall plugin pam") + + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipUnless(pam_found, "no pam plugin") +- @unittest2.skipIf(os.environ.get('PASSWORD') is None, "PASSWORD env var required") +- @unittest2.skipIf(os.environ.get('PAMSERVICE') is None, "PAMSERVICE env var required") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(not pam_found, reason="no pam plugin") ++ @pytest.mark.skipif(os.environ.get('PASSWORD') is None, reason="PASSWORD env var required") ++ @pytest.mark.skipif(os.environ.get('PAMSERVICE') is None, reason="PAMSERVICE env var required") + def testPamAuth(self): + self.realTestPamAuth() + +@@ -311,16 +311,16 @@ class TestAuthentication(base.PyMySQLTes + # select old_password("crummy p\tassword"); + #| old_password("crummy p\tassword") | + #| 2a01785203b08770 | +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipUnless(mysql_old_password_found, "no mysql_old_password plugin") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(not mysql_old_password_found, reason="no mysql_old_password plugin") + def testMySQLOldPasswordAuth(self): + conn = self.connect() + if self.mysql_server_is(conn, (5, 7, 0)): +- raise unittest2.SkipTest('Old passwords aren\'t supported in 5.7') ++ pytest.skip('Old passwords aren\'t supported in 5.7') + # pymysql.err.OperationalError: (1045, "Access denied for user 'old_pass_user'@'localhost' (using password: YES)") + # from login in MySQL-5.6 + if self.mysql_server_is(conn, (5, 6, 0)): +- raise unittest2.SkipTest('Old passwords don\'t authenticate in 5.6') ++ pytest.skip('Old passwords don\'t authenticate in 5.6') + db = self.db.copy() + db['password'] = "crummy p\tassword" + c = conn.cursor() +@@ -354,8 +354,8 @@ class TestAuthentication(base.PyMySQLTes + cur.execute("SELECT VERSION()") + c.execute('set global secure_auth=%r' % secure_auth_setting) + +- @unittest2.skipUnless(socket_auth, "connection to unix_socket required") +- @unittest2.skipUnless(sha256_password_found, "no sha256 password authentication plugin found") ++ @pytest.mark.skipif(not socket_auth, reason="connection to unix_socket required") ++ @pytest.mark.skipif(not sha256_password_found, reason="no sha256 password authentication plugin found") + def testAuthSHA256(self): + conn = self.connect() + c = conn.cursor() +Index: PyMySQL-0.9.3/pymysql/tests/test_err.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/test_err.py 2016-09-01 13:09:00.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/test_err.py 2020-06-03 10:13:17.705278419 +0200 +@@ -1,4 +1,4 @@ +-import unittest2 ++import unittest + + from pymysql import err + +@@ -6,7 +6,7 @@ from pymysql import err + __all__ = ["TestRaiseException"] + + +-class TestRaiseException(unittest2.TestCase): ++class TestRaiseException(unittest.TestCase): + + def test_raise_mysql_exception(self): + data = b"\xff\x15\x04Access denied" +Index: PyMySQL-0.9.3/pymysql/tests/test_issues.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/test_issues.py 2018-12-18 10:58:59.000000000 +0100 ++++ PyMySQL-0.9.3/pymysql/tests/test_issues.py 2020-06-03 10:13:17.705278419 +0200 +@@ -3,11 +3,12 @@ import time + import warnings + import sys + ++import pytest ++ + import pymysql + from pymysql import cursors + from pymysql._compat import text_type + from pymysql.tests import base +-import unittest2 + + try: + import imp +@@ -145,7 +146,7 @@ KEY (`station`,`dh`,`echeance`)) ENGINE= + finally: + c.execute("drop table issue16") + +- @unittest2.skip("test_issue_17() requires a custom, legacy MySQL configuration and will not be run.") ++ @pytest.mark.skip("test_issue_17() requires a custom, legacy MySQL configuration and will not be run.") + def test_issue_17(self): + """could not connect mysql use passwod""" + conn = self.connect() +@@ -189,7 +190,7 @@ class TestNewIssues(base.PyMySQLTestCase + c.execute(u"select name from hei\xdfe") + self.assertEqual(u"Pi\xdfata", c.fetchone()[0]) + +- @unittest2.skip("This test requires manual intervention") ++ @pytest.mark.skip("This test requires manual intervention") + def test_issue_35(self): + conn = self.connect() + c = conn.cursor() +Index: PyMySQL-0.9.3/pymysql/tests/test_nextset.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/test_nextset.py 2018-05-07 13:40:08.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/test_nextset.py 2020-06-03 10:13:17.705278419 +0200 +@@ -1,4 +1,4 @@ +-import unittest2 ++import pytest + + import pymysql + from pymysql import util +@@ -50,7 +50,7 @@ class TestNextset(base.PyMySQLTestCase): + self.assertEqual([(2,)], list(cur)) + self.assertFalse(bool(cur.nextset())) + +- @unittest2.expectedFailure ++ @pytest.mark.xfail + def test_multi_cursor(self): + con = self.connect(client_flag=CLIENT.MULTI_STATEMENTS) + cur1 = con.cursor() +Index: PyMySQL-0.9.3/pymysql/tests/thirdparty/__init__.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/thirdparty/__init__.py 2014-08-29 13:32:54.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/thirdparty/__init__.py 2020-06-03 10:13:17.705278419 +0200 +@@ -1,8 +1,5 @@ + from .test_MySQLdb import * + + if __name__ == "__main__": +- try: +- import unittest2 as unittest +- except ImportError: +- import unittest ++ import unittest + unittest.main() +Index: PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/capabilities.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/thirdparty/test_MySQLdb/capabilities.py 2018-05-07 13:40:08.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/capabilities.py 2020-06-03 10:13:17.705278419 +0200 +@@ -6,10 +6,7 @@ + """ + import sys + from time import time +-try: +- import unittest2 as unittest +-except ImportError: +- import unittest ++import unittest + + PY2 = sys.version_info[0] == 2 + +Index: PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py 2018-03-26 09:46:10.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py 2020-06-03 10:13:17.705278419 +0200 +@@ -14,12 +14,8 @@ __rcs_id__ = '$Id$' + __version__ = '$Revision$'[11:-2] + __author__ = 'Stuart Bishop ' + +-try: +- import unittest2 as unittest +-except ImportError: +- import unittest +- + import time ++import unittest + + # $Log$ + # Revision 1.1.2.1 2006/02/25 03:44:32 adustman +Index: PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py 2018-05-07 13:55:31.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py 2020-06-03 10:13:17.705278419 +0200 +@@ -1,8 +1,5 @@ + from . import capabilities +-try: +- import unittest2 as unittest +-except ImportError: +- import unittest ++import unittest + import pymysql + from pymysql.tests import base + import warnings +Index: PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py 2018-03-26 09:46:10.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py 2020-06-03 10:13:17.705278419 +0200 +@@ -2,10 +2,7 @@ from . import dbapi20 + import pymysql + from pymysql.tests import base + +-try: +- import unittest2 as unittest +-except ImportError: +- import unittest ++import unittest + + + class test_MySQLdb(dbapi20.DatabaseAPI20Test): +Index: PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py +=================================================================== +--- PyMySQL-0.9.3.orig/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py 2018-03-26 09:46:10.000000000 +0200 ++++ PyMySQL-0.9.3/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py 2020-06-03 10:13:17.705278419 +0200 +@@ -1,8 +1,5 @@ + import sys +-try: +- import unittest2 as unittest +-except ImportError: +- import unittest ++import unittest + + import pymysql + _mysql = pymysql +Index: PyMySQL-0.9.3/runtests.py +=================================================================== +--- PyMySQL-0.9.3.orig/runtests.py 2018-06-27 11:32:13.000000000 +0200 ++++ /dev/null 1970-01-01 00:00:00.000000000 +0000 +@@ -1,31 +0,0 @@ +-#!/usr/bin/env python +-import unittest2 +- +-from pymysql._compat import PYPY, JYTHON, IRONPYTHON +- +-#import pymysql +-#pymysql.connections.DEBUG = True +-#pymysql._auth.DEBUG = True +- +-if not (PYPY or JYTHON or IRONPYTHON): +- import atexit +- import gc +- gc.set_debug(gc.DEBUG_UNCOLLECTABLE) +- +- @atexit.register +- def report_uncollectable(): +- import gc +- if not gc.garbage: +- print("No garbages!") +- return +- print('uncollectable objects') +- for obj in gc.garbage: +- print(obj) +- if hasattr(obj, '__dict__'): +- print(obj.__dict__) +- for ref in gc.get_referrers(obj): +- print("referrer:", ref) +- print('---') +- +-import pymysql.tests +-unittest2.main(pymysql.tests, verbosity=2) +Index: PyMySQL-0.9.3/tox.ini +=================================================================== +--- PyMySQL-0.9.3.orig/tox.ini 2018-12-17 12:37:20.000000000 +0100 ++++ PyMySQL-0.9.3/tox.ini 2020-06-03 10:13:17.705278419 +0200 +@@ -1,10 +1,9 @@ + [tox] +-envlist = py27,py34,py35,py36,py37,pypy,pypy3 ++envlist = py27,py35,py36,py37,pypy,pypy3 + + [testenv] +-commands = coverage run ./runtests.py +-deps = unittest2 +- coverage ++commands = pytest -v pymysql/tests/ ++deps = coverage pytest + passenv = USER + PASSWORD + PAMSERVICE diff --git a/python-PyMySQL.changes b/python-PyMySQL.changes index 71272e3..5add681 100644 --- a/python-PyMySQL.changes +++ b/python-PyMySQL.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Jun 4 09:21:14 UTC 2020 - pgajdos@suse.com + +- test package with mariadb +- added patches + https://github.com/PyMySQL/PyMySQL/commit/a500fcd64d4500417540a2a2ff7b16a88d1872ad + + python-PyMySQL-no-unittest2.patch + ------------------------------------------------------------------- Wed Mar 6 09:11:17 UTC 2019 - Tomáš Chvátal diff --git a/python-PyMySQL.spec b/python-PyMySQL.spec index 5d34b8f..de9e270 100644 --- a/python-PyMySQL.spec +++ b/python-PyMySQL.spec @@ -1,7 +1,7 @@ # # spec file for package python-PyMySQL # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,12 +24,14 @@ Summary: Pure Python MySQL Driver License: MIT Group: Development/Languages/Python URL: https://github.com/PyMySQL/PyMySQL/ -Source: https://files.pythonhosted.org/packages/source/P/PyMySQL/PyMySQL-%{version}.tar.gz +Source: https://github.com/PyMySQL/PyMySQL/archive/v%{version}.tar.gz#/PyMySQL-0.9.3.tar.gz +# https://github.com/PyMySQL/PyMySQL/commit/a500fcd64d4500417540a2a2ff7b16a88d1872ad +Patch0: python-PyMySQL-no-unittest2.patch BuildRequires: %{python_module cryptography} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: mariadb-rpm-macros # will be removed with next release -BuildRequires: %{python_module unittest2} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-cryptography @@ -48,6 +50,7 @@ its unit tests as well as running it against the MySQLdb and myconnpy unit tests %prep %setup -q -n PyMySQL-%{version} +%patch0 -p1 # remove unwanted shebang sed -i '1 { /^#!/ d }' pymysql/tests/thirdparty/test_MySQLdb/*.py @@ -59,8 +62,37 @@ sed -i '1 { /^#!/ d }' pymysql/tests/thirdparty/test_MySQLdb/*.py %python_expand %fdupes %{buildroot}%{$python_sitelib} %check +exit_code=0 +dbuser='db_user' +dbuserpw='db_user_secret' +dbname1='test1' +dbname2='test2' # Needs mysql server #%%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_bin_suffix} -v +cconf=abuild-myclient.cnf +# +# start the mariadb server +# +%mysql_testserver_start -u $dbuser -p $dbuserpw -d $dbname1:$dbname2 -t 3306 +# +# creating client config, see base.py +# +cat << EOF > pymysql/tests/databases.json +[{"host":"localhost","user":"$dbuser","passwd":"$dbuserpw", + "db":"$dbname1", "use_unicode": true, "local_infile": true}, + {"host":"localhost","user":"$dbuser","passwd":"$dbuserpw","db":"$dbname2"}] +EOF +# +# running the test +# +export USER="$dbuser" +export PASSWORD="$dbuserpw" +%pytest pymysql/tests || exit_code=1 +# +# stopping mariadb +# +%mysql_testserver_stop +exit $exit_code %files %{python_files} %license LICENSE