Skip to content

Commit 8202408

Browse files
committed
tests
1 parent fd714ed commit 8202408

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

tests/unit/test_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def __init__(self):
288288
whitenoise_serve_static=pretend.call_recorder(lambda *a, **kw: None),
289289
whitenoise_add_files=pretend.call_recorder(lambda *a, **kw: None),
290290
whitenoise_add_manifest=pretend.call_recorder(lambda *a, **kw: None),
291-
scan=pretend.call_recorder(lambda categories, ignore: None),
291+
scan=pretend.call_recorder(lambda categories, ignore=False: None),
292292
commit=pretend.call_recorder(lambda: None),
293293
add_view_deriver=pretend.call_recorder(lambda *a, **kw: None),
294294
)
@@ -429,6 +429,7 @@ def __init__(self):
429429
pretend.call(".cache"),
430430
pretend.call(".email"),
431431
pretend.call(".accounts"),
432+
pretend.call("social_pyramid"),
432433
pretend.call(".macaroons"),
433434
pretend.call(".oidc"),
434435
pretend.call(".attestations"),
@@ -520,6 +521,7 @@ def __init__(self):
520521
pretend.call(
521522
categories=(
522523
"pyramid",
524+
"social_pyramid",
523525
"warehouse",
524526
),
525527
ignore=["warehouse.migrations.env", "warehouse.celery", "warehouse.wsgi"],

warehouse/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
from warehouse.authnz import Permissions
3838
from warehouse.constants import MAX_FILESIZE, MAX_PROJECT_SIZE, ONE_GIB, ONE_MIB
39-
from warehouse.db import ModelBase, Session
39+
from warehouse.db import ModelBase, Session, metadata
4040
from warehouse.utils.static import ManifestCacheBuster
4141
from warehouse.utils.wsgi import ProxyFixer, VhmRootRemover
4242

@@ -828,8 +828,8 @@ def configure(settings=None):
828828
config.registry.settings["SOCIAL_AUTH_USER_MODEL"] = (
829829
"warehouse.accounts.models.User"
830830
)
831-
init_social(config, ModelBase, Session)
832-
config.scan("social_pyramid")
831+
if "social_auth_usersocialauth" not in metadata.tables:
832+
init_social(config, ModelBase, Session)
833833

834834
# Register support for Macaroon based authentication
835835
config.include(".macaroons")
@@ -961,6 +961,7 @@ def configure(settings=None):
961961
config.scan(
962962
categories=(
963963
"pyramid",
964+
"social_pyramid",
964965
"warehouse",
965966
),
966967
ignore=["warehouse.migrations.env", "warehouse.celery", "warehouse.wsgi"],

0 commit comments

Comments
 (0)