summaryrefslogtreecommitdiff
path: root/dev-python/pymysql
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-06-13 10:39:22 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-06-13 10:39:22 +0100
commit9452a6e87b6c2c70513bc47a2470bf9f1168920e (patch)
tree8ac67e26b45f34d71c5aab3621813b100a0d5f00 /dev-python/pymysql
parentf516638b7fe9592837389826a6152a7e1b251c54 (diff)
gentoo resync : 13.06.2020
Diffstat (limited to 'dev-python/pymysql')
-rw-r--r--dev-python/pymysql/Manifest2
-rw-r--r--dev-python/pymysql/pymysql-0.9.3.ebuild75
2 files changed, 71 insertions, 6 deletions
diff --git a/dev-python/pymysql/Manifest b/dev-python/pymysql/Manifest
index 4d79d7c61c73..6736de148533 100644
--- a/dev-python/pymysql/Manifest
+++ b/dev-python/pymysql/Manifest
@@ -1,3 +1,3 @@
DIST pymysql-0.9.3.tar.gz 86715 BLAKE2B 0ed09f7f5c47bd1fae52dd9d0ff0790367962d8e4b89d3933704b8b8d838e1f48b68455a9a3916318bf3c1c1f102fa11b4e1e3401d021f8a2d6137612a4affb9 SHA512 d906b7a6612d91db7d4f7f2d85a9375477e6655c568e0d1e7281ad0263d4a78f0ac4e80263605723f99e12db04c80f51c5c8ed79ed6f209a7afeb4b45bf40648
-EBUILD pymysql-0.9.3.ebuild 673 BLAKE2B 212b7d4936c89adc6426410428777b63a35dc5d43316a5a6b93c38fd0a6e46e375ffb049e2dd08414b3b77597fcbec01e3dbae4dd6bfdf074f0552d877e53d3e SHA512 20eaf4eee1ebf709cfdae707c5aef191d6a5fcdb68ef33cd13f5b448787bb4ec829794ee50431047bb5115555012fdbea198b319bcc259504bbaa6c906e1d569
+EBUILD pymysql-0.9.3.ebuild 2141 BLAKE2B 53cd7fa1adf3224e595e841339296441f31df2261fce0fbd1955bc903444eb218b89a2b8845ebaff4d9cd75bcd2fd29733d20cd16f68aed710e097c26922787b SHA512 3b854cd5af1502d81e6157f20044311152da0d2cd7fa471d88e68bdd284a380caad920f89594eb085f52da07d3e03d11a3a78fa7888d54e54263fbc8fdec7443
MISC metadata.xml 553 BLAKE2B a3f93a6e059fcb457326fe8ca880b1a268be1d5d847a0bd8648156036428a5e2f6cbe47adda3e3cb220c236b4307bb0dba8ea616842437e2408407fae01c16bb SHA512 3799a369db7d62654ead99e579ea2b7f19e33c35654fb4f721e37a46f4a449d67f1173f45abf8e34b330e87a872c0182d7a47dcda97a6d2c40e78ebfab6841bd
diff --git a/dev-python/pymysql/pymysql-0.9.3.ebuild b/dev-python/pymysql/pymysql-0.9.3.ebuild
index e0580ba49848..7346a5ab5fb2 100644
--- a/dev-python/pymysql/pymysql-0.9.3.ebuild
+++ b/dev-python/pymysql/pymysql-0.9.3.ebuild
@@ -3,7 +3,7 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
+PYTHON_COMPAT=( python3_{6..9} pypy3 )
inherit distutils-r1
@@ -13,18 +13,83 @@ MY_P="${MY_PN}-${PV}"
DESCRIPTION="Pure-Python MySQL Driver"
HOMEPAGE="https://github.com/PyMySQL/PyMySQL"
SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+S=${WORKDIR}/${MY_P}
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~arm64 x86"
IUSE="test"
+RESTRICT="!test? ( test )"
-S=${WORKDIR}/${MY_P}
+# TODO: support other mysql variants
+BDEPEND="
+ test? ( dev-db/mariadb[server] )"
+
+src_prepare() {
+ find -name '*.py' -exec sed -i -e 's:unittest2:unittest:' {} + || die
+ distutils-r1_src_prepare
+}
+
+src_test() {
+ mkdir -p "${T}"/mysql || die
+ "${BROOT}"/usr/share/mariadb/scripts/mysql_install_db \
+ --no-defaults \
+ --auth-root-authentication-method=normal \
+ --basedir="${BROOT}/usr" \
+ --datadir="${T}"/mysql || die
+ # TODO: random port
+ mysqld \
+ --no-defaults \
+ --character-set-server=utf8 \
+ --bind-address=127.0.0.1 \
+ --port=43306 \
+ --socket="${T}"/mysqld.sock \
+ --datadir="${T}"/mysql &
+ local pid=${!}
+
+ # wait for it to start
+ local i
+ for (( i = 0; i < 10; i++)); do
+ [[ -S ${T}/mysqld.sock ]] && break
+ sleep 1
+ done
+ [[ -S ${T}/mysqld.sock ]] || die "mysqld failed to start"
-DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+ # create test databases
+ mysql -uroot --socket="${T}"/mysqld.sock -e '
+ create database test1 DEFAULT CHARACTER SET utf8mb4;
+ create database test2 DEFAULT CHARACTER SET utf8mb4;
-# While tests exist, they require an unsecure server to run without manual config file
-RESTRICT="test"
+ create user test2 identified by "some password";
+ grant all on test2.* to test2;
+
+ create user test2@localhost identified by "some password";
+ grant all on test2.* to test2@localhost;
+ ' || die
+
+ cat > pymysql/tests/databases.json <<-EOF || die
+ [{
+ "host": "localhost",
+ "user": "root",
+ "passwd": "",
+ "db": "test1",
+ "use_unicode": true,
+ "local_infile": true,
+ "unix_socket": "${T}/mysqld.sock"
+ }, {
+ "host": "localhost",
+ "user": "root",
+ "passwd": "",
+ "db": "test2",
+ "unix_socket": "${T}/mysqld.sock"
+ }]
+ EOF
+
+ distutils-r1_src_test
+
+ kill "${pid}"
+ wait "${pid}"
+}
python_test() {
${PYTHON} runtests.py || die