From 114aa45f19433bd4a565071426b8eff395047228 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 15 Aug 2023 01:46:43 -0400 Subject: [PATCH 1/5] Update Flask plugins and related dependencies This changeset updates a few of the Flask plugins we rely on to their latest versions, as well as the psycopg2-binary library. It required a few adjustments to how our tests are configured and run, which are probably due for a larger refactor given how much has changed with these libraries and the anticipated change of going from SQLAlchemy 1.4.x to 2.0.x. Signed-off-by: Carlo Costino --- Pipfile | 8 +- Pipfile.lock | 198 +++++++++++++++++++++++----------------------- tests/conftest.py | 37 +++++++-- 3 files changed, 136 insertions(+), 107 deletions(-) diff --git a/Pipfile b/Pipfile index f73362cd9..0e391c237 100644 --- a/Pipfile +++ b/Pipfile @@ -37,10 +37,10 @@ docutils = "==0.16" eventlet = "==0.33.3" flask = "~=2.3" flask-bcrypt = "==1.0.1" -flask-marshmallow = "==0.14.0" -flask-migrate = "==4.0.1" +flask-marshmallow = "==0.15.0" +flask-migrate = "==4.0.4" flask-redis = "==0.4.0" -flask-sqlalchemy = {version = "==2.5.1", ref = "aa7a61a5357cf6f5dcc135d98c781192457aa6fa", git = "https://github.com/pallets-eco/flask-sqlalchemy.git"} +flask-sqlalchemy = "==3.0.5" gunicorn = {version = "==20.1.0", extras = ["eventlet"], ref = "1299ea9e967a61ae2edebe191082fd169b864c64", git = "https://github.com/benoitc/gunicorn.git"} iso8601 = "==2.0.0" itsdangerous = "==2.1.2" @@ -50,7 +50,7 @@ marshmallow = "==3.20.1" marshmallow-sqlalchemy = "==0.29.0" notifications-python-client = "==6.3.0" oscrypto = "==1.3.0" -psycopg2-binary = "==2.9.3" +psycopg2-binary = "==2.9.7" pyjwt = "==2.8.0" python-dotenv = "==1.0.0" radon = "==6.0.1" diff --git a/Pipfile.lock b/Pipfile.lock index 7db0ecfdd..c9e1141b6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "26353f993db47609e2e79c1c455f6e898ea9e4a6179d02e279829e5377462861" + "sha256": "0b4231d3027251f5b90eced0dd6099091ac6536237ac3baa8e905a07af253194" }, "pipfile-spec": 6, "requires": { @@ -384,19 +384,19 @@ }, "flask-marshmallow": { "hashes": [ - "sha256:2adcd782b5a4a6c5ae3c96701f320d8ca6997995a52b2661093c56cc3ed24754", - "sha256:bd01a6372cbe50e36f205cfff0fc5dab0b7b662c4c8b2c4fc06a3151b2950950" + "sha256:2083ae55bebb5142fff98c6bbd483a2f5dbc531a8bc1be2180ed5f75e7f3fccc", + "sha256:ce08a153f74da6ebfffd8065d1687508b0179df37fff7fc0c8f28ccfb64f1b56" ], "index": "pypi", - "version": "==0.14.0" + "version": "==0.15.0" }, "flask-migrate": { "hashes": [ - "sha256:eaf85579b273874b25944016745ff84c7dc712297c42b7b71f4dc6cae8a2934d", - "sha256:f62b51f9cd2c4f444deac111726a2335d0b846dcf51909a97e261d2098b816f7" + "sha256:73293d40b10ac17736e715b377e7b7bde474cb8105165d77474df4c3619b10b3", + "sha256:77580f27ab39bc68be4906a43c56d7674b45075bc4f883b1d0b985db5164d58f" ], "index": "pypi", - "version": "==4.0.1" + "version": "==4.0.4" }, "flask-redis": { "hashes": [ @@ -407,9 +407,12 @@ "version": "==0.4.0" }, "flask-sqlalchemy": { - "git": "https://github.com/pallets-eco/flask-sqlalchemy.git", - "ref": "aa7a61a5357cf6f5dcc135d98c781192457aa6fa", - "version": "==2.5.1" + "hashes": [ + "sha256:c5765e58ca145401b52106c0f46178569243c5da25556be2c231ecc60867c5b1", + "sha256:cabb6600ddd819a9f859f36515bb1bd8e7dbf30206cc679d2b081dff9e383283" + ], + "index": "pypi", + "version": "==3.0.5" }, "fqdn": { "hashes": [ @@ -787,24 +790,24 @@ }, "newrelic": { "hashes": [ - "sha256:13662a5eec5b64a5ec5e220fa1a7ac99c5e7ff6eb868bb303273689e7c90d762", - "sha256:23450caafa8da15a8a6632642b64a6b1921335a4edd58caeb9f244d740e190b9", - "sha256:260d9536d4a2c910387aa13c91621e88f96567bb4acf7278608cd1905c25808b", - "sha256:4f86037cd179a21efaef52784567c3fc951b400f72fe08567b19d47ab31a6a9d", - "sha256:54c607fb502582484f3bb0e134b19a3634d9b07e79474082d1cde9ff31616844", - "sha256:57159c99ee6a37f1e487ac5ab68fd67afd1407da1689705b3560f7a903867453", - "sha256:732dd981bcda6030c9c377eb8765c60ba5f510ba2052b689cb92a964b16290c0", - "sha256:755d210314f208735a4e53a8ba124ada00fda1fd3ccbdc6d8f01a0d521711c1f", - "sha256:7eb535500073363d25e14ff4a30379957972339530c600673a7bccb26f009aef", - "sha256:a8e8cdfd5ac5f8e58aa11909921e65b4da8afb721de996cd4ecd5c372e339c3c", - "sha256:d9b1ad14417e424b8db24c2da9f4f095b4ea3fac27cf6d5efdeebd140ad07086", - "sha256:ec36f973d6835eb6a0f27871c0dc8127e8bbc4118c3456dbf3f8ef4aae7d707a", - "sha256:f2200b2d4e70b0544a5b99b5103c96eecdf204cc2bbbf499106ad93ebd8f6469", - "sha256:f249f06dbc8b1a160532ece3d6b1989be1ed63c2fe3f569a8913d7c2f0ee9a7e", - "sha256:fa53d9610ba18a577a3bb62e3fc9e22c13e8b99a88ef8f8f6ebc5538f0390ff0" + "sha256:2567ba9e29fd7b9f4c23cf16a5a149097eb0e5da587734c5a40732d75aaec189", + "sha256:365d3b1a10d1021217beeb28a93c1356a9feb94bd24f02972691dc71227e40dc", + "sha256:4ed36fb91f152128825459eae9a52da364352ea95bcd78b405b0a5b8057b2ed7", + "sha256:55a64d2abadf69bbc7bb01178332c4f25247689a97b01a62125d162ea7ec8974", + "sha256:722072d57e2d416de68b650235878583a2a8809ea39c7dd5c8c11a19089b7665", + "sha256:8a2271b76ea684a63936302579d6085d46a2b54042cb91dc9b0d71a0cd4dd38b", + "sha256:9601d886669fe1e0c23bbf91fb68ab23086011816ba96c6dd714c60dc0a74088", + "sha256:b6cddd869ac8f7f32f6de8212ae878a21c9e63f2183601d239a76d38c5d5a366", + "sha256:cf3b67327e64d2b50aec855821199b2bc46bc0c2d142df269d420748dd49b31b", + "sha256:d9af0130e1f1ca032c606d15a6d5558d27273a063b7c53702218b3beccd50b23", + "sha256:dbda843100c99ac3291701c0a70fedb705c0b0707800c60b93657d3985aae357", + "sha256:ecd0666557419dbe11b04e3b38480b3113b3c4670d42619420d60352a1956dd8", + "sha256:f2fd24b32dbf510e4e3fe40b71ad395dd73a4bb9f5eaf59eb5ff22ed76ba2d41", + "sha256:f9c9f7842234a51e4a2fdafe42c42ebe0b6b1966279f2f91ec8a9c16480c2236", + "sha256:fc975c29548e25805ead794d9de7ab3cb8ba4a6a106098646e1ab03112d1432e" ], "index": "pypi", - "version": "==8.9.0" + "version": "==8.10.0" }, "notifications-python-client": { "hashes": [ @@ -816,7 +819,7 @@ "notifications-utils": { "editable": true, "git": "https://github.com/GSA/notifications-utils.git", - "ref": "8c19510302841e3a5688bb33281800c8c3076243" + "ref": "9197f35d9bf07983cd632a8b50f098d5eba762f0" }, "numpy": { "hashes": [ @@ -891,73 +894,74 @@ "sha256:04505ade687dc26dc4284b1ad19a83be2f2afe83e7a828ace0c72f3a1df72aac", "sha256:9dffbe1d8acf91e3de75f3b544e4842382fc06c6babe903ac9acb74dc6e08d88" ], - "markers": "python_version >= '3.7'", + "markers": "python_full_version >= '3.7.0'", "version": "==3.0.39" }, "psycopg2-binary": { "hashes": [ - "sha256:01310cf4cf26db9aea5158c217caa92d291f0500051a6469ac52166e1a16f5b7", - "sha256:083a55275f09a62b8ca4902dd11f4b33075b743cf0d360419e2051a8a5d5ff76", - "sha256:090f3348c0ab2cceb6dfbe6bf721ef61262ddf518cd6cc6ecc7d334996d64efa", - "sha256:0a29729145aaaf1ad8bafe663131890e2111f13416b60e460dae0a96af5905c9", - "sha256:0c9d5450c566c80c396b7402895c4369a410cab5a82707b11aee1e624da7d004", - "sha256:10bb90fb4d523a2aa67773d4ff2b833ec00857f5912bafcfd5f5414e45280fb1", - "sha256:12b11322ea00ad8db8c46f18b7dfc47ae215e4df55b46c67a94b4effbaec7094", - "sha256:152f09f57417b831418304c7f30d727dc83a12761627bb826951692cc6491e57", - "sha256:15803fa813ea05bef089fa78835118b5434204f3a17cb9f1e5dbfd0b9deea5af", - "sha256:15c4e4cfa45f5a60599d9cec5f46cd7b1b29d86a6390ec23e8eebaae84e64554", - "sha256:183a517a3a63503f70f808b58bfbf962f23d73b6dccddae5aa56152ef2bcb232", - "sha256:1f14c8b0942714eb3c74e1e71700cbbcb415acbc311c730370e70c578a44a25c", - "sha256:1f6b813106a3abdf7b03640d36e24669234120c72e91d5cbaeb87c5f7c36c65b", - "sha256:280b0bb5cbfe8039205c7981cceb006156a675362a00fe29b16fbc264e242834", - "sha256:2d872e3c9d5d075a2e104540965a1cf898b52274a5923936e5bfddb58c59c7c2", - "sha256:2f2534ab7dc7e776a263b463a16e189eb30e85ec9bbe1bff9e78dae802608932", - "sha256:2f9ffd643bc7349eeb664eba8864d9e01f057880f510e4681ba40a6532f93c71", - "sha256:3303f8807f342641851578ee7ed1f3efc9802d00a6f83c101d21c608cb864460", - "sha256:35168209c9d51b145e459e05c31a9eaeffa9a6b0fd61689b48e07464ffd1a83e", - "sha256:3a79d622f5206d695d7824cbf609a4f5b88ea6d6dab5f7c147fc6d333a8787e4", - "sha256:404224e5fef3b193f892abdbf8961ce20e0b6642886cfe1fe1923f41aaa75c9d", - "sha256:46f0e0a6b5fa5851bbd9ab1bc805eef362d3a230fbdfbc209f4a236d0a7a990d", - "sha256:47133f3f872faf28c1e87d4357220e809dfd3fa7c64295a4a148bcd1e6e34ec9", - "sha256:526ea0378246d9b080148f2d6681229f4b5964543c170dd10bf4faaab6e0d27f", - "sha256:53293533fcbb94c202b7c800a12c873cfe24599656b341f56e71dd2b557be063", - "sha256:539b28661b71da7c0e428692438efbcd048ca21ea81af618d845e06ebfd29478", - "sha256:57804fc02ca3ce0dbfbef35c4b3a4a774da66d66ea20f4bda601294ad2ea6092", - "sha256:63638d875be8c2784cfc952c9ac34e2b50e43f9f0a0660b65e2a87d656b3116c", - "sha256:6472a178e291b59e7f16ab49ec8b4f3bdada0a879c68d3817ff0963e722a82ce", - "sha256:68641a34023d306be959101b345732360fc2ea4938982309b786f7be1b43a4a1", - "sha256:6e82d38390a03da28c7985b394ec3f56873174e2c88130e6966cb1c946508e65", - "sha256:761df5313dc15da1502b21453642d7599d26be88bff659382f8f9747c7ebea4e", - "sha256:7af0dd86ddb2f8af5da57a976d27cd2cd15510518d582b478fbb2292428710b4", - "sha256:7b1e9b80afca7b7a386ef087db614faebbf8839b7f4db5eb107d0f1a53225029", - "sha256:874a52ecab70af13e899f7847b3e074eeb16ebac5615665db33bce8a1009cf33", - "sha256:887dd9aac71765ac0d0bac1d0d4b4f2c99d5f5c1382d8b770404f0f3d0ce8a39", - "sha256:8b344adbb9a862de0c635f4f0425b7958bf5a4b927c8594e6e8d261775796d53", - "sha256:8fc53f9af09426a61db9ba357865c77f26076d48669f2e1bb24d85a22fb52307", - "sha256:91920527dea30175cc02a1099f331aa8c1ba39bf8b7762b7b56cbf54bc5cce42", - "sha256:93cd1967a18aa0edd4b95b1dfd554cf15af657cb606280996d393dadc88c3c35", - "sha256:99485cab9ba0fa9b84f1f9e1fef106f44a46ef6afdeec8885e0b88d0772b49e8", - "sha256:9d29409b625a143649d03d0fd7b57e4b92e0ecad9726ba682244b73be91d2fdb", - "sha256:a29b3ca4ec9defec6d42bf5feb36bb5817ba3c0230dd83b4edf4bf02684cd0ae", - "sha256:a9e1f75f96ea388fbcef36c70640c4efbe4650658f3d6a2967b4cc70e907352e", - "sha256:accfe7e982411da3178ec690baaceaad3c278652998b2c45828aaac66cd8285f", - "sha256:adf20d9a67e0b6393eac162eb81fb10bc9130a80540f4df7e7355c2dd4af9fba", - "sha256:af9813db73395fb1fc211bac696faea4ca9ef53f32dc0cfa27e4e7cf766dcf24", - "sha256:b1c8068513f5b158cf7e29c43a77eb34b407db29aca749d3eb9293ee0d3103ca", - "sha256:b3a24a1982ae56461cc24f6680604fffa2c1b818e9dc55680da038792e004d18", - "sha256:bda845b664bb6c91446ca9609fc69f7db6c334ec5e4adc87571c34e4f47b7ddb", - "sha256:c381bda330ddf2fccbafab789d83ebc6c53db126e4383e73794c74eedce855ef", - "sha256:c3ae8e75eb7160851e59adc77b3a19a976e50622e44fd4fd47b8b18208189d42", - "sha256:d1c1b569ecafe3a69380a94e6ae09a4789bbb23666f3d3a08d06bbd2451f5ef1", - "sha256:def68d7c21984b0f8218e8a15d514f714d96904265164f75f8d3a70f9c295667", - "sha256:dffc08ca91c9ac09008870c9eb77b00a46b3378719584059c034b8945e26b272", - "sha256:e3699852e22aa68c10de06524a3721ade969abf382da95884e6a10ff798f9281", - "sha256:e6aa71ae45f952a2205377773e76f4e3f27951df38e69a4c95440c779e013560", - "sha256:e847774f8ffd5b398a75bc1c18fbb56564cda3d629fe68fd81971fece2d3c67e", - "sha256:ffb7a888a047696e7f8240d649b43fb3644f14f0ee229077e7f6b9f9081635bd" + "sha256:00d8db270afb76f48a499f7bb8fa70297e66da67288471ca873db88382850bf4", + "sha256:024eaeb2a08c9a65cd5f94b31ace1ee3bb3f978cd4d079406aef85169ba01f08", + "sha256:094af2e77a1976efd4956a031028774b827029729725e136514aae3cdf49b87b", + "sha256:1011eeb0c51e5b9ea1016f0f45fa23aca63966a4c0afcf0340ccabe85a9f65bd", + "sha256:11abdbfc6f7f7dea4a524b5f4117369b0d757725798f1593796be6ece20266cb", + "sha256:122641b7fab18ef76b18860dd0c772290566b6fb30cc08e923ad73d17461dc63", + "sha256:17cc17a70dfb295a240db7f65b6d8153c3d81efb145d76da1e4a096e9c5c0e63", + "sha256:18f12632ab516c47c1ac4841a78fddea6508a8284c7cf0f292cb1a523f2e2379", + "sha256:1b918f64a51ffe19cd2e230b3240ba481330ce1d4b7875ae67305bd1d37b041c", + "sha256:1c31c2606ac500dbd26381145684d87730a2fac9a62ebcfbaa2b119f8d6c19f4", + "sha256:26484e913d472ecb6b45937ea55ce29c57c662066d222fb0fbdc1fab457f18c5", + "sha256:2993ccb2b7e80844d534e55e0f12534c2871952f78e0da33c35e648bf002bbff", + "sha256:2b04da24cbde33292ad34a40db9832a80ad12de26486ffeda883413c9e1b1d5e", + "sha256:2dec5a75a3a5d42b120e88e6ed3e3b37b46459202bb8e36cd67591b6e5feebc1", + "sha256:2df562bb2e4e00ee064779902d721223cfa9f8f58e7e52318c97d139cf7f012d", + "sha256:3fbb1184c7e9d28d67671992970718c05af5f77fc88e26fd7136613c4ece1f89", + "sha256:42a62ef0e5abb55bf6ffb050eb2b0fcd767261fa3faf943a4267539168807522", + "sha256:4ecc15666f16f97709106d87284c136cdc82647e1c3f8392a672616aed3c7151", + "sha256:4eec5d36dbcfc076caab61a2114c12094c0b7027d57e9e4387b634e8ab36fd44", + "sha256:4fe13712357d802080cfccbf8c6266a3121dc0e27e2144819029095ccf708372", + "sha256:51d1b42d44f4ffb93188f9b39e6d1c82aa758fdb8d9de65e1ddfe7a7d250d7ad", + "sha256:59f7e9109a59dfa31efa022e94a244736ae401526682de504e87bd11ce870c22", + "sha256:62cb6de84d7767164a87ca97e22e5e0a134856ebcb08f21b621c6125baf61f16", + "sha256:642df77484b2dcaf87d4237792246d8068653f9e0f5c025e2c692fc56b0dda70", + "sha256:6822c9c63308d650db201ba22fe6648bd6786ca6d14fdaf273b17e15608d0852", + "sha256:692df8763b71d42eb8343f54091368f6f6c9cfc56dc391858cdb3c3ef1e3e584", + "sha256:6d92e139ca388ccfe8c04aacc163756e55ba4c623c6ba13d5d1595ed97523e4b", + "sha256:7952807f95c8eba6a8ccb14e00bf170bb700cafcec3924d565235dffc7dc4ae8", + "sha256:7db7b9b701974c96a88997d458b38ccb110eba8f805d4b4f74944aac48639b42", + "sha256:81d5dd2dd9ab78d31a451e357315f201d976c131ca7d43870a0e8063b6b7a1ec", + "sha256:8a136c8aaf6615653450817a7abe0fc01e4ea720ae41dfb2823eccae4b9062a3", + "sha256:8a7968fd20bd550431837656872c19575b687f3f6f98120046228e451e4064df", + "sha256:8c721ee464e45ecf609ff8c0a555018764974114f671815a0a7152aedb9f3343", + "sha256:8f309b77a7c716e6ed9891b9b42953c3ff7d533dc548c1e33fddc73d2f5e21f9", + "sha256:8f94cb12150d57ea433e3e02aabd072205648e86f1d5a0a692d60242f7809b15", + "sha256:95a7a747bdc3b010bb6a980f053233e7610276d55f3ca506afff4ad7749ab58a", + "sha256:9b0c2b466b2f4d89ccc33784c4ebb1627989bd84a39b79092e560e937a11d4ac", + "sha256:9dcfd5d37e027ec393a303cc0a216be564b96c80ba532f3d1e0d2b5e5e4b1e6e", + "sha256:a5ee89587696d808c9a00876065d725d4ae606f5f7853b961cdbc348b0f7c9a1", + "sha256:a6a8b575ac45af1eaccbbcdcf710ab984fd50af048fe130672377f78aaff6fc1", + "sha256:ac83ab05e25354dad798401babaa6daa9577462136ba215694865394840e31f8", + "sha256:ad26d4eeaa0d722b25814cce97335ecf1b707630258f14ac4d2ed3d1d8415265", + "sha256:ad5ec10b53cbb57e9a2e77b67e4e4368df56b54d6b00cc86398578f1c635f329", + "sha256:c82986635a16fb1fa15cd5436035c88bc65c3d5ced1cfaac7f357ee9e9deddd4", + "sha256:ced63c054bdaf0298f62681d5dcae3afe60cbae332390bfb1acf0e23dcd25fc8", + "sha256:d0b16e5bb0ab78583f0ed7ab16378a0f8a89a27256bb5560402749dbe8a164d7", + "sha256:dbbc3c5d15ed76b0d9db7753c0db40899136ecfe97d50cbde918f630c5eb857a", + "sha256:ded8e15f7550db9e75c60b3d9fcbc7737fea258a0f10032cdb7edc26c2a671fd", + "sha256:e02bc4f2966475a7393bd0f098e1165d470d3fa816264054359ed4f10f6914ea", + "sha256:e5666632ba2b0d9757b38fc17337d84bdf932d38563c5234f5f8c54fd01349c9", + "sha256:ea5f8ee87f1eddc818fc04649d952c526db4426d26bab16efbe5a0c52b27d6ab", + "sha256:eb1c0e682138f9067a58fc3c9a9bf1c83d8e08cfbee380d858e63196466d5c86", + "sha256:eb3b8d55924a6058a26db69fb1d3e7e32695ff8b491835ba9f479537e14dcf9f", + "sha256:ee919b676da28f78f91b464fb3e12238bd7474483352a59c8a16c39dfc59f0c5", + "sha256:f02f4a72cc3ab2565c6d9720f0343cb840fb2dc01a2e9ecb8bc58ccf95dc5c06", + "sha256:f4f37bbc6588d402980ffbd1f3338c871368fb4b1cfa091debe13c68bb3852b3", + "sha256:f8651cf1f144f9ee0fa7d1a1df61a9184ab72962531ca99f077bbdcba3947c58", + "sha256:f955aa50d7d5220fcb6e38f69ea126eafecd812d96aeed5d5f3597f33fad43bb", + "sha256:fc10da7e7df3380426521e8c1ed975d22df678639da2ed0ec3244c3dc2ab54c8", + "sha256:fdca0511458d26cf39b827a663d7d87db6f32b93efc22442a742035728603d5f" ], "index": "pypi", - "version": "==2.9.3" + "version": "==2.9.7" }, "pyasn1": { "hashes": [ @@ -1135,7 +1139,7 @@ "sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2", "sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9" ], - "markers": "python_full_version >= '3.5.0' and python_full_version < '4.0.0'", + "markers": "python_version >= '3.5' and python_version < '4'", "version": "==4.7.2" }, "s3transfer": { @@ -1332,11 +1336,11 @@ }, "werkzeug": { "hashes": [ - "sha256:935539fa1413afbb9195b24880778422ed620c0fc09670945185cce4d91a8890", - "sha256:98c774df2f91b05550078891dee5f0eb0cb797a522c757a2452b9cee5b202330" + "sha256:2b8c0e447b4b9dbcc85dd97b6eeb4dcbaf6c8b6c3be0bd654e25553e0a2157d8", + "sha256:effc12dba7f3bd72e605ce49807bbe692bd729c3bb122a3b91747a6ae77df528" ], "index": "pypi", - "version": "==2.3.6" + "version": "==2.3.7" }, "wrapt": { "hashes": [ @@ -2272,7 +2276,7 @@ "sha256:4659bc2a667783e7a15d190f6fccf8b2486685b6dba4c19c3876314769c57526", "sha256:b4fa3a7a0be38243123cf9d1f3518da10c51bdb165a2b2985566247f9155a7d3" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==32.0.1" }, "pluggy": { @@ -2485,7 +2489,7 @@ "sha256:146a90b3b6b47cac4a73c12866a499e9817426423f57c5a66949c086191a8808", "sha256:fb9d6c0a0f643c99eed3875b5377a184132ba9be4d61516a55273d3554d75a39" ], - "markers": "python_version >= '3.7'", + "markers": "python_full_version >= '3.7.0'", "version": "==13.5.2" }, "s3transfer": { @@ -2575,11 +2579,11 @@ }, "werkzeug": { "hashes": [ - "sha256:935539fa1413afbb9195b24880778422ed620c0fc09670945185cce4d91a8890", - "sha256:98c774df2f91b05550078891dee5f0eb0cb797a522c757a2452b9cee5b202330" + "sha256:2b8c0e447b4b9dbcc85dd97b6eeb4dcbaf6c8b6c3be0bd654e25553e0a2157d8", + "sha256:effc12dba7f3bd72e605ce49807bbe692bd729c3bb122a3b91747a6ae77df528" ], "index": "pypi", - "version": "==2.3.6" + "version": "==2.3.7" }, "xmltodict": { "hashes": [ diff --git a/tests/conftest.py b/tests/conftest.py index 69d91e9b9..e59b45f18 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,13 +7,30 @@ from alembic.command import upgrade from alembic.config import Config from flask import Flask -from app import create_app, db +from app import create_app +from app.config import configs from app.dao.provider_details_dao import get_provider_details_by_identifier @pytest.fixture(scope='session') -def notify_app(): +def notify_app(worker_id): app = Flask('test') + + # Override the SQLALCHEMY_DATABASE_URI config before the app is + # initialized to account for Flask-SQLAlchemy 3.0.x changes. + # What is ultimately happening is the create_engine call made with + # SQLAlchemy itself is now only happening at the time of calling + # init_app with Flask instead of at the time it is first accessed, + # which the _notify_db fixture method was relying on. + + # See the following for more information: + # https://github.com/pallets-eco/flask-sqlalchemy/pull/1087 + # https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/api/#module-flask_sqlalchemy + app.config['SQLALCHEMY_DATABASE_URI'] = '{}_{}'.format( + os.getenv('SQLALCHEMY_DATABASE_TEST_URI', '').replace('postgres://', 'postgresql://'), + worker_id + ) + create_app(app) return app @@ -72,16 +89,15 @@ def create_test_db(database_uri): @pytest.fixture(scope='session') -def _notify_db(notify_api, worker_id): +def _notify_db(notify_api): """ Manages the connection to the database. Generally this shouldn't be used, instead you should use the `notify_db_session` fixture which also cleans up any data you've got left over after your test run. """ - assert 'test_notification_api' in db.engine.url.database, 'dont run tests against main db' # create a database for this worker thread - from flask import current_app - current_app.config['SQLALCHEMY_DATABASE_URI'] += '_{}'.format(worker_id) + #current_app.config['SQLALCHEMY_DATABASE_URI'] += '_{}'.format(worker_id) create_test_db(current_app.config['SQLALCHEMY_DATABASE_URI']) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) @@ -92,10 +108,19 @@ def _notify_db(notify_api, worker_id): with notify_api.app_context(): upgrade(config, 'head') + # Retrieve the DB object from the initialized app. + db = notify_api.extensions['sqlalchemy'] + + # Check the DB name. + assert 'test_notification_api' in db.engine.url.database, 'dont run tests against main db' + + # Modify the URL to point to the correct test database. + db.engine.url = current_app.config['SQLALCHEMY_DATABASE_URI'] + yield db db.session.remove() - db.get_engine(notify_api).dispose() + db.engine.dispose() @pytest.fixture(scope='function') From d9abca9dbeaf5bb532a9d081a1bc959ba8b38280 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 15 Aug 2023 01:56:48 -0400 Subject: [PATCH 2/5] Fix comments and imports causing build errors Signed-off-by: Carlo Costino --- tests/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index e59b45f18..88b849987 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,7 +8,6 @@ from alembic.config import Config from flask import Flask from app import create_app -from app.config import configs from app.dao.provider_details_dao import get_provider_details_by_identifier @@ -95,9 +94,10 @@ def _notify_db(notify_api): `notify_db_session` fixture which also cleans up any data you've got left over after your test run. """ - # create a database for this worker thread - + # Create a database for this worker thread; note that the + # SQLALCHEMY_DATABASE_URI config variable was already reset with the + # worker ID in the notify_app fixture method. from flask import current_app - #current_app.config['SQLALCHEMY_DATABASE_URI'] += '_{}'.format(worker_id) create_test_db(current_app.config['SQLALCHEMY_DATABASE_URI']) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) From 5519d17e09747e098c0111e086e8b4d0b8a0054b Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 15 Aug 2023 09:58:54 -0400 Subject: [PATCH 3/5] Fix database URI for concurrent test workers Signed-off-by: Carlo Costino --- tests/conftest.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 88b849987..e2ffb0bd2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -88,16 +88,18 @@ def create_test_db(database_uri): @pytest.fixture(scope='session') -def _notify_db(notify_api): +def _notify_db(notify_api, worker_id): """ Manages the connection to the database. Generally this shouldn't be used, instead you should use the `notify_db_session` fixture which also cleans up any data you've got left over after your test run. """ - # Create a database for this worker thread; note that the - # SQLALCHEMY_DATABASE_URI config variable was already reset with the - # worker ID in the notify_app fixture method. + # Create a database for this worker thread; note that we still have + # to reset it here to point to the correct database. from flask import current_app + current_app.config['SQLALCHEMY_DATABASE_URI'] += '_{}'.format( + worker_id + ) create_test_db(current_app.config['SQLALCHEMY_DATABASE_URI']) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) From 17e13c3b3b547cfbf5d85d2e6d160e3eb3eef60e Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 15 Aug 2023 10:58:16 -0400 Subject: [PATCH 4/5] Round 2 of attempting to fix CI test runs Signed-off-by: Carlo Costino --- tests/conftest.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index e2ffb0bd2..37b88a62f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -106,23 +106,22 @@ def _notify_db(notify_api, worker_id): ALEMBIC_CONFIG = os.path.join(BASE_DIR, 'migrations') config = Config(ALEMBIC_CONFIG + '/alembic.ini') config.set_main_option("script_location", ALEMBIC_CONFIG) + config.set_main_option( + "sqlalchemy.url", + current_app.config['SQLALCHEMY_DATABASE_URI'] + ) - with notify_api.app_context(): + with notify_api.app_context() as app_context: + # Run DB migrations. upgrade(config, 'head') - # Retrieve the DB object from the initialized app. - db = notify_api.extensions['sqlalchemy'] + # Modify the database connection URL to point to the correct + # test database. + db = app_context.app.extensions['sqlalchemy'] + db.engine.url = current_app.config['SQLALCHEMY_DATABASE_URI'] - # Check the DB name. - assert 'test_notification_api' in db.engine.url.database, 'dont run tests against main db' - - # Modify the URL to point to the correct test database. - db.engine.url = current_app.config['SQLALCHEMY_DATABASE_URI'] - - yield db - - db.session.remove() - db.engine.dispose() + # Return the DB object to the test calling for it. + yield db @pytest.fixture(scope='function') From 206d5fccb76a7e450d968898878f9c3ebd6d4f2b Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 15 Aug 2023 18:03:49 -0400 Subject: [PATCH 5/5] Simplify test config for now This is in prep for switching to running a single test worker for the time being. We will spend time figuring out how to get multiple concurrent workers going again separately as we seem to have several issues taking place right now with that type of test setup. Signed-off-by: Carlo Costino --- tests/conftest.py | 88 ++++++++++------------------------------------- 1 file changed, 18 insertions(+), 70 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 37b88a62f..ad3ceebec 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,7 +2,6 @@ import os from contextlib import contextmanager import pytest -import sqlalchemy from alembic.command import upgrade from alembic.config import Config from flask import Flask @@ -12,35 +11,14 @@ from app.dao.provider_details_dao import get_provider_details_by_identifier @pytest.fixture(scope='session') -def notify_app(worker_id): +def notify_app(): app = Flask('test') - - # Override the SQLALCHEMY_DATABASE_URI config before the app is - # initialized to account for Flask-SQLAlchemy 3.0.x changes. - # What is ultimately happening is the create_engine call made with - # SQLAlchemy itself is now only happening at the time of calling - # init_app with Flask instead of at the time it is first accessed, - # which the _notify_db fixture method was relying on. - - # See the following for more information: - # https://github.com/pallets-eco/flask-sqlalchemy/pull/1087 - # https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/api/#module-flask_sqlalchemy - app.config['SQLALCHEMY_DATABASE_URI'] = '{}_{}'.format( - os.getenv('SQLALCHEMY_DATABASE_TEST_URI', '').replace('postgres://', 'postgresql://'), - worker_id - ) - create_app(app) return app @pytest.fixture(scope='session') def notify_api(notify_app): - # deattach server-error error handlers - error_handler_spec looks like: - # {'blueprint_name': { - # status_code: [error_handlers], - # None: { ExceptionClass: error_handler } - # }} for error_handlers in notify_app.error_handler_spec.values(): error_handlers.pop(500, None) if None in error_handlers: @@ -66,63 +44,33 @@ def client(notify_api): yield client -def create_test_db(database_uri): - # get the - db_uri_parts = database_uri.split('/') - postgres_db_uri = '/'.join(db_uri_parts[:-1] + ['postgres']) - - postgres_db = sqlalchemy.create_engine( - postgres_db_uri, - echo=False, - isolation_level='AUTOCOMMIT', - client_encoding='utf8' - ) - try: - result = postgres_db.execute(sqlalchemy.sql.text('CREATE DATABASE {}'.format(db_uri_parts[-1]))) - result.close() - except sqlalchemy.exc.ProgrammingError: - # database "test_notification_api_master" already exists - pass - finally: - postgres_db.dispose() - - @pytest.fixture(scope='session') -def _notify_db(notify_api, worker_id): +def _notify_db(notify_api): """ Manages the connection to the database. Generally this shouldn't be used, instead you should use the `notify_db_session` fixture which also cleans up any data you've got left over after your test run. """ - - # Create a database for this worker thread; note that we still have - # to reset it here to point to the correct database. - from flask import current_app - current_app.config['SQLALCHEMY_DATABASE_URI'] += '_{}'.format( - worker_id - ) - create_test_db(current_app.config['SQLALCHEMY_DATABASE_URI']) - - BASE_DIR = os.path.dirname(os.path.dirname(__file__)) - ALEMBIC_CONFIG = os.path.join(BASE_DIR, 'migrations') - config = Config(ALEMBIC_CONFIG + '/alembic.ini') - config.set_main_option("script_location", ALEMBIC_CONFIG) - config.set_main_option( - "sqlalchemy.url", - current_app.config['SQLALCHEMY_DATABASE_URI'] - ) - with notify_api.app_context() as app_context: - # Run DB migrations. + db = app_context.app.extensions['sqlalchemy'] + assert 'test_notification_api' in db.engine.url.database, 'dont run tests against main db' + + BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + ALEMBIC_CONFIG = os.path.join(BASE_DIR, 'migrations') + config = Config(ALEMBIC_CONFIG + '/alembic.ini') + config.set_main_option('script_location', ALEMBIC_CONFIG) + config.set_main_option( + 'sqlalchemy.url', + app_context.app.config['SQLALCHEMY_DATABASE_URI'] + ) + + # Run migrations on the test database. upgrade(config, 'head') - # Modify the database connection URL to point to the correct - # test database. - db = app_context.app.extensions['sqlalchemy'] - db.engine.url = current_app.config['SQLALCHEMY_DATABASE_URI'] - - # Return the DB object to the test calling for it. yield db + db.session.remove() + db.engine.dispose() + @pytest.fixture(scope='function') def sms_providers(_notify_db):