Skip to content

Commit

Permalink
wip?
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAlbertQC committed Jul 12, 2024
1 parent bad5a88 commit b3b8d28
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions plugins/quetz_conda_suggest/tests/test_quetz_conda_suggest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def test_conda_suggest_endpoint_without_upload(client, channel, subdir):
assert response.json() == None # noqa: E711


def test_post_add_package_version(package_version, db, config):
def test_post_add_package_version(
package_version, db, config, session_maker_expire_on_commit
):
filename = "test-package-0.1-0.tar.bz2"

with tempfile.SpooledTemporaryFile(mode="wb") as target:
Expand All @@ -26,12 +28,11 @@ def test_post_add_package_version(package_version, db, config):
target.seek(0)
condainfo = CondaInfo(target, filename)

def get_db():
return db

from quetz_conda_suggest import main

with mock.patch("quetz_conda_suggest.main.get_session", get_db):
with mock.patch(
"quetz_conda_suggest.main.get_session", session_maker_expire_on_commit
):
main.post_add_package_version(package_version, condainfo)

meta = db.query(db_models.CondaSuggestMetadata).first()
Expand All @@ -48,7 +49,9 @@ def get_db():
b"lib/libtpkg.so\n",
b"lib/pkgconfig/libtpkg.pc\n",
]
with mock.patch("quetz_conda_suggest.main.get_session", get_db):
with mock.patch(
"quetz_conda_suggest.main.get_session", session_maker_expire_on_commit
):
main.post_add_package_version(package_version, condainfo)

meta = db.query(db_models.CondaSuggestMetadata).all()
Expand Down

0 comments on commit b3b8d28

Please sign in to comment.