diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-11-15 19:12:03 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-11-15 19:16:57 +0100 |
commit | e4e3fc0fc321e37ddf14283848db14d97dba6bec (patch) | |
tree | 12eb8ed26984a2af4cc611251ea206ef36ffeb2c /dev-python/flask-migrate | |
parent | media-tv/mythtv: Remove py3.8-only versions (diff) | |
download | gentoo-e4e3fc0fc321e37ddf14283848db14d97dba6bec.tar.gz gentoo-e4e3fc0fc321e37ddf14283848db14d97dba6bec.tar.bz2 gentoo-e4e3fc0fc321e37ddf14283848db14d97dba6bec.zip |
dev-python/flask-migrate: Replace test patch with a simpler hack
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/flask-migrate')
-rw-r--r-- | dev-python/flask-migrate/files/flask-migrate-4.0.0-system-venv.patch | 174 | ||||
-rw-r--r-- | dev-python/flask-migrate/flask-migrate-4.0.0.ebuild | 15 |
2 files changed, 12 insertions, 177 deletions
diff --git a/dev-python/flask-migrate/files/flask-migrate-4.0.0-system-venv.patch b/dev-python/flask-migrate/files/flask-migrate-4.0.0-system-venv.patch deleted file mode 100644 index 47899909d1c7..000000000000 --- a/dev-python/flask-migrate/files/flask-migrate-4.0.0-system-venv.patch +++ /dev/null @@ -1,174 +0,0 @@ -diff --git a/tests/test_custom_template.py b/tests/test_custom_template.py -index fe55fe4..ade8388 100644 ---- a/tests/test_custom_template.py -+++ b/tests/test_custom_template.py -@@ -3,12 +3,16 @@ import shutil - import unittest - import subprocess - import shlex -+import sys - - --def run_cmd(app, cmd): -- """Run a command and return a tuple with (stdout, stderr, exit_code)""" -+def run_flask(app, cmd): -+ """ -+ Run a flask command and return a tuple with (stdout, stderr, exit_code) -+ """ - os.environ['FLASK_APP'] = app -- process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, -+ process = subprocess.Popen([sys.executable, '-m', 'flask'] + -+ shlex.split(cmd), stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - (stdout, stderr) = process.communicate() - print('\n$ ' + cmd) -@@ -54,11 +58,11 @@ class TestMigrate(unittest.TestCase): - self.assertTrue(isinstance(v, int)) - - def test_migrate_upgrade(self): -- (o, e, s) = run_cmd('app.py', 'flask db init -t ./custom_template') -+ (o, e, s) = run_flask('app.py', 'db init -t ./custom_template') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app.py', 'flask db migrate') -+ (o, e, s) = run_flask('app.py', 'db migrate') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app.py', 'flask db upgrade') -+ (o, e, s) = run_flask('app.py', 'db upgrade') - self.assertTrue(s == 0) - - from .app import app, db, User -diff --git a/tests/test_migrate.py b/tests/test_migrate.py -index 08e60c7..3f22d38 100644 ---- a/tests/test_migrate.py -+++ b/tests/test_migrate.py -@@ -3,12 +3,16 @@ import shutil - import unittest - import subprocess - import shlex -+import sys - - --def run_cmd(app, cmd): -- """Run a command and return a tuple with (stdout, stderr, exit_code)""" -+def run_flask(app, cmd): -+ """ -+ Run a flask command and return a tuple with (stdout, stderr, exit_code) -+ """ - os.environ['FLASK_APP'] = app -- process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, -+ process = subprocess.Popen([sys.executable, '-m', 'flask'] + -+ shlex.split(cmd), stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - (stdout, stderr) = process.communicate() - print('\n$ ' + cmd) -@@ -54,11 +58,11 @@ class TestMigrate(unittest.TestCase): - self.assertTrue(isinstance(v, int)) - - def test_migrate_upgrade(self): -- (o, e, s) = run_cmd('app.py', 'flask db init') -+ (o, e, s) = run_flask('app.py', 'db init') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app.py', 'flask db migrate') -+ (o, e, s) = run_flask('app.py', 'db migrate') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app.py', 'flask db upgrade') -+ (o, e, s) = run_flask('app.py', 'db upgrade') - self.assertTrue(s == 0) - - from .app import app, db, User -@@ -67,11 +71,11 @@ class TestMigrate(unittest.TestCase): - db.session.commit() - - def test_custom_directory(self): -- (o, e, s) = run_cmd('app_custom_directory.py', 'flask db init') -+ (o, e, s) = run_flask('app_custom_directory.py', 'db init') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_custom_directory.py', 'flask db migrate') -+ (o, e, s) = run_flask('app_custom_directory.py', 'db migrate') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_custom_directory.py', 'flask db upgrade') -+ (o, e, s) = run_flask('app_custom_directory.py', 'db upgrade') - self.assertTrue(s == 0) - - from .app_custom_directory import app, db, User -@@ -80,11 +84,11 @@ class TestMigrate(unittest.TestCase): - db.session.commit() - - def test_custom_directory_path(self): -- (o, e, s) = run_cmd('app_custom_directory_path.py', 'flask db init') -+ (o, e, s) = run_flask('app_custom_directory_path.py', 'db init') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_custom_directory_path.py', 'flask db migrate') -+ (o, e, s) = run_flask('app_custom_directory_path.py', 'db migrate') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_custom_directory_path.py', 'flask db upgrade') -+ (o, e, s) = run_flask('app_custom_directory_path.py', 'db upgrade') - self.assertTrue(s == 0) - - from .app_custom_directory_path import app, db, User -@@ -93,13 +97,13 @@ class TestMigrate(unittest.TestCase): - db.session.commit() - - def test_compare_type(self): -- (o, e, s) = run_cmd('app_compare_type1.py', 'flask database init') -+ (o, e, s) = run_flask('app_compare_type1.py', 'database init') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_compare_type1.py', 'flask database migrate') -+ (o, e, s) = run_flask('app_compare_type1.py', 'database migrate') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_compare_type1.py', 'flask database upgrade') -+ (o, e, s) = run_flask('app_compare_type1.py', 'database upgrade') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_compare_type2.py', 'flask database migrate') -+ (o, e, s) = run_flask('app_compare_type2.py', 'database migrate') - self.assertTrue(s == 0) - self.assertTrue(b'Detected type change from VARCHAR(length=128) ' - b'to String(length=10)' in e) -diff --git a/tests/test_multidb_migrate.py b/tests/test_multidb_migrate.py -index 1a40c18..e65106d 100644 ---- a/tests/test_multidb_migrate.py -+++ b/tests/test_multidb_migrate.py -@@ -4,12 +4,16 @@ import unittest - import subprocess - import shlex - import sqlite3 -+import sys - - --def run_cmd(app, cmd): -- """Run a command and return a tuple with (stdout, stderr, exit_code)""" -+def run_flask(app, cmd): -+ """ -+ Run a flask command and return a tuple with (stdout, stderr, exit_code) -+ """ - os.environ['FLASK_APP'] = app -- process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, -+ process = subprocess.Popen([sys.executable, '-m', 'flask'] + -+ shlex.split(cmd), stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - (stdout, stderr) = process.communicate() - print('\n$ ' + cmd) -@@ -43,11 +47,11 @@ class TestMigrate(unittest.TestCase): - pass - - def test_multidb_migrate_upgrade(self): -- (o, e, s) = run_cmd('app_multidb.py', 'flask db init --multidb') -+ (o, e, s) = run_flask('app_multidb.py', 'db init --multidb') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_multidb.py', 'flask db migrate') -+ (o, e, s) = run_flask('app_multidb.py', 'db migrate') - self.assertTrue(s == 0) -- (o, e, s) = run_cmd('app_multidb.py', 'flask db upgrade') -+ (o, e, s) = run_flask('app_multidb.py', 'db upgrade') - self.assertTrue(s == 0) - - # ensure the tables are in the correct databases -@@ -75,7 +79,7 @@ class TestMigrate(unittest.TestCase): - db.session.commit() - - # ensure the downgrade works -- (o, e, s) = run_cmd('app_multidb.py', 'flask db downgrade') -+ (o, e, s) = run_flask('app_multidb.py', 'db downgrade') - self.assertTrue(s == 0) - - conn1 = sqlite3.connect('app1.db') diff --git a/dev-python/flask-migrate/flask-migrate-4.0.0.ebuild b/dev-python/flask-migrate/flask-migrate-4.0.0.ebuild index 7bcae0f8c1f8..55f3c685a9f2 100644 --- a/dev-python/flask-migrate/flask-migrate-4.0.0.ebuild +++ b/dev-python/flask-migrate/flask-migrate-4.0.0.ebuild @@ -32,6 +32,15 @@ RDEPEND=" distutils_enable_tests unittest -PATCHES=( - "${FILESDIR}"/${P}-system-venv.patch -) +python_test() { + local -x PATH=${T}/bin:${PATH} + + mkdir -p "${T}"/bin || die + cat > "${T}"/bin/flask <<-EOF || die + #!/bin/sh + exec ${EPYTHON} -m flask "\${@}" + EOF + chmod +x "${T}"/bin/flask || die + + eunittest +} |