From 93eba65f4673757ee4cb46b9f57fca363c88e19d Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 30 Dec 2022 20:13:48 +0100 Subject: [PATCH] python3Packages.sqlalchemy-utils: 0.38.3 -> 0.39.0 --- .../sqlalchemy-utils/default.nix | 89 ++++++++++++++----- .../skip-database-tests.patch | 78 ++-------------- 2 files changed, 72 insertions(+), 95 deletions(-) diff --git a/pkgs/development/python-modules/sqlalchemy-utils/default.nix b/pkgs/development/python-modules/sqlalchemy-utils/default.nix index 49bba2811312..af108f17c0d3 100644 --- a/pkgs/development/python-modules/sqlalchemy-utils/default.nix +++ b/pkgs/development/python-modules/sqlalchemy-utils/default.nix @@ -1,58 +1,101 @@ { lib , buildPythonPackage , fetchPypi -, six +, pythonOlder + +# runtime +, importlib-metadata , sqlalchemy -, colour -, flexmock -, jinja2 -, mock -, pg8000 + +# optionals +, babel +, arrow +, pendulum +#, intervals , phonenumbers -, pygments -, pymysql -, pytestCheckHook +, passlib +, colour , python-dateutil +, furl +, cryptography + +# tests +, pytestCheckHook +, pygments +, jinja2 +, docutils +, flexmock +, psycopg2 +, psycopg2cffi +, pg8000 +, pytz +, backports-zoneinfo +, pymysql +, pyodbc + }: buildPythonPackage rec { pname = "sqlalchemy-utils"; - version = "0.38.3"; + version = "0.39.0"; + format = "setuptools"; src = fetchPypi { inherit version; pname = "SQLAlchemy-Utils"; - sha256 = "sha256-n5r7pgekBFXPcDrfqYRlhL8mFooMWmCnAGO3DWUFH00="; + hash = "sha256-s3JAkX2BwU/htuUJakArrORysXkSE4TkfBDYVNv1r5I="; }; patches = [ - # We don't run MySQL, MSSQL, or PostgreSQL ./skip-database-tests.patch ]; propagatedBuildInputs = [ - six sqlalchemy + ] ++ lib.optionals (pythonOlder "3.8") [ + importlib-metadata ]; + passthru.optional-dependencies = { + babel = [ babel ]; + arrow = [ arrow ]; + pendulum = [ pendulum ]; + #intervals = [ intervals ]; + phone = [ phonenumbers ]; + password = [ passlib ]; + color = [ colour ]; + timezone = [ python-dateutil ]; + url = [ furl ]; + encrypted = [ cryptography ]; + }; + checkInputs = [ - colour - flexmock - jinja2 - mock - pg8000 - phonenumbers - pygments - pymysql pytestCheckHook + pygments + jinja2 + docutils + flexmock + psycopg2 + psycopg2cffi + pg8000 + pytz python-dateutil + pymysql + pyodbc + ] + ++ lib.flatten (builtins.attrValues passthru.optional-dependencies) + ++ lib.optionals (pythonOlder "3.9") [ + backports-zoneinfo ]; - disabledTests = [ - "test_literal_bind" + pytestFlagsArray = [ + "--deselect tests/functions/test_database.py::TestDatabasePostgresCreateDatabaseCloseConnection::test_create_database_twice" + "--deselect tests/functions/test_database.py::TestDatabasePostgresPg8000::test_create_and_drop" + "--deselect tests/functions/test_database.py::TestDatabasePostgresPsycoPG2CFFI::test_create_and_drop" ]; meta = with lib; { + changelog = "https://github.com/kvesteri/sqlalchemy-utils/releases/tag/${version}"; homepage = "https://github.com/kvesteri/sqlalchemy-utils"; description = "Various utility functions and datatypes for SQLAlchemy"; license = licenses.bsd3; diff --git a/pkgs/development/python-modules/sqlalchemy-utils/skip-database-tests.patch b/pkgs/development/python-modules/sqlalchemy-utils/skip-database-tests.patch index 79aa12f03d99..d5f9a46ecb88 100644 --- a/pkgs/development/python-modules/sqlalchemy-utils/skip-database-tests.patch +++ b/pkgs/development/python-modules/sqlalchemy-utils/skip-database-tests.patch @@ -1,13 +1,12 @@ diff --git a/conftest.py b/conftest.py -index 9e146cd..8dbc9a5 100644 +index 4426e02..1f84096 100644 --- a/conftest.py +++ b/conftest.py -@@ -61,17 +61,12 @@ def mysql_db_user(): - +@@ -73,17 +73,12 @@ def mysql_db_user(): @pytest.fixture def postgresql_dsn(postgresql_db_user, postgresql_db_password, postgresql_db_host, db_name): -- return 'postgresql://{0}:{1}@{2}/{3}'.format( +- return 'postgresql://{}:{}@{}/{}'.format( - postgresql_db_user, - postgresql_db_password, - postgresql_db_host, @@ -18,83 +17,18 @@ index 9e146cd..8dbc9a5 100644 @pytest.fixture def mysql_dsn(mysql_db_user, db_name): -- return 'mysql+pymysql://{0}@localhost/{1}'.format(mysql_db_user, db_name) +- return f'mysql+pymysql://{mysql_db_user}@localhost/{db_name}' + pytest.skip() @pytest.fixture -@@ -108,8 +104,7 @@ def mssql_db_driver(): +@@ -121,8 +116,7 @@ def mssql_db_driver(): @pytest.fixture def mssql_dsn(mssql_db_user, mssql_db_password, mssql_db_driver, db_name): -- return 'mssql+pyodbc://{0}:{1}@localhost/{2}?driver={3}'\ +- return 'mssql+pyodbc://{}:{}@localhost/{}?driver={}'\ - .format(mssql_db_user, mssql_db_password, db_name, mssql_db_driver) + pytest.skip() @pytest.fixture -diff --git a/tests/functions/test_database.py b/tests/functions/test_database.py -index 0ad6721..83f208d 100644 ---- a/tests/functions/test_database.py -+++ b/tests/functions/test_database.py -@@ -76,28 +76,6 @@ class TestDatabasePostgres(DatabaseTest): - "TEMPLATE my_template") in str(excinfo.value) - - --class TestDatabasePostgresPg8000(DatabaseTest): -- -- @pytest.fixture -- def dsn(self, postgresql_db_user, postgresql_db_password): -- return 'postgresql+pg8000://{0}:{1}@localhost/{2}'.format( -- postgresql_db_user, -- postgresql_db_password, -- 'db_to_test_create_and_drop_via_pg8000_driver' -- ) -- -- --class TestDatabasePostgresPsycoPG2CFFI(DatabaseTest): -- -- @pytest.fixture -- def dsn(self, postgresql_db_user, postgresql_db_password): -- return 'postgresql+psycopg2cffi://{0}:{1}@localhost/{2}'.format( -- postgresql_db_user, -- postgresql_db_password, -- 'db_to_test_create_and_drop_via_psycopg2cffi_driver' -- ) -- -- - @pytest.mark.usefixtures('postgresql_dsn') - class TestDatabasePostgresWithQuotedName(DatabaseTest): - -@@ -116,31 +94,6 @@ class TestDatabasePostgresWithQuotedName(DatabaseTest): - 'TEMPLATE "my-template"') in str(excinfo.value) - - --class TestDatabasePostgresCreateDatabaseCloseConnection: -- def test_create_database_twice( -- self, -- postgresql_db_user, -- postgresql_db_password -- ): -- dsn_list = [ -- 'postgresql://{0}:{1}@localhost/db_test_sqlalchemy-util-a'.format( -- postgresql_db_user, -- postgresql_db_password -- ), -- 'postgresql://{0}:{1}@localhost/db_test_sqlalchemy-util-b'.format( -- postgresql_db_user, -- postgresql_db_password -- ), -- ] -- for dsn_item in dsn_list: -- assert not database_exists(dsn_item) -- create_database(dsn_item, template="template1") -- assert database_exists(dsn_item) -- for dsn_item in dsn_list: -- drop_database(dsn_item) -- assert not database_exists(dsn_item) -- -- - @pytest.mark.usefixtures('mssql_dsn') - class TestDatabaseMssql(DatabaseTest): -