Skip to content

Commit

Permalink
Bump sqlalchemy version
Browse files Browse the repository at this point in the history
The upgrade path from sqlalchemy 1.4 -> 2.0 was designed to have
a seamless upgrade path.
Docs: https://docs.sqlalchemy.org/en/20/changelog/migration_20.html#the-1-4-2-0-migration-path
  • Loading branch information
soapy1 committed Nov 14, 2024
1 parent bb4dcc3 commit 3d80318
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion conda-store-server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
# pinning them; conda-lock depends on this, but also doesn't pin the setuptools
# version. See https://github.com/pypa/setuptools/issues/4478 for details
"setuptools<70",
"sqlalchemy<2.0a0",
"sqlalchemy>=2.0,<2.1",
"traitlets",
"uvicorn",
"yarl",
Expand Down
24 changes: 10 additions & 14 deletions conda-store-server/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,46 +126,42 @@ def test_namespace_role_mapping(db):
assert len(api.list_namespaces(db).all()) == 1

# Creates role mappings with valid entity names
NamespaceRoleMapping(
db.add(NamespaceRoleMapping(
namespace=namespace,
namespace_id=namespace.id,
entity="org/*",
role="editor",
)
NamespaceRoleMapping(
))
db.add(NamespaceRoleMapping(
namespace=namespace,
namespace_id=namespace.id,
entity="*/team",
role="editor",
)
NamespaceRoleMapping(
))
db.add(NamespaceRoleMapping(
namespace=namespace,
namespace_id=namespace.id,
entity="org/team",
role="editor",
)
NamespaceRoleMapping(
))
db.add(NamespaceRoleMapping(
namespace=namespace,
namespace_id=namespace.id,
entity="*/*",
role="editor",
)
))

# Check that the namespace role mappings were correctly inserted;
# this will fail if they were not correctly instantiated.
db.commit()

# Create a role mapping with a failing entity
with pytest.raises(Exception):
NamespaceRoleMapping(
db.add(NamespaceRoleMapping(
namespace=namespace,
namespace_id=namespace.id,
entity="invalid_entity_name",
)

# This should fail because of the invalid entity instantiation above
with pytest.raises(IntegrityError):
db.commit()
))


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ outputs:
- pyyaml >=6.0.1
- redis-py
- requests
- sqlalchemy <2.0a0
- sqlalchemy >=2.0,<2.1
- traitlets
- uvicorn
- yarl
Expand Down

0 comments on commit 3d80318

Please sign in to comment.