From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 2JLzCj8eC2bdwQAAe85BDQ:P1 (envelope-from ) for ; Mon, 01 Apr 2024 22:51:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 2JLzCj8eC2bdwQAAe85BDQ (envelope-from ) for ; Mon, 01 Apr 2024 22:51:11 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=imyL+jKt; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1712004671; a=rsa-sha256; cv=none; b=CMd28y4AHV/DxNC1vvAQ9zH1gdQhaL3n6yBCGEnSYdZ0C3IBfr23zvE5geC/Bda8fjo8VG mcT5ie38zoxz96DPeAtUCPCYuBfni4TTceIa5ZC9NcrPAI07BvpNSjGbG+TPvNO9jHRn5q ifizTjUv807BVs3PazLbFqazSZPKA8BvoKWEhOAZ7Xl4fYt73vkuRY2P72dLUSKTAVYV/F sNDXTOr1g6t8812caku481owmC4VzqQ1CIFc8IonYlofE6w4P0j7tJ3Cj5zVZ4CP+H6wg+ wEp75wuyuZUagxp88L4oPDXaIELMgdlTSkq+lRuwHWE4cjGgD4Vbwl5ETNd6SA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=imyL+jKt; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1712004671; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=3wAsMFihu2Oqe/dqaKpP9L4a1pY5noKRPEU808jzaOo=; b=eTIePQHS87mSmSmWCQPWRE/fRtZBsheHc4JVx15Mhv2TYynh5zaCq3Je7Nn5jYRlkdGIwq e0uuTsHv8S0ouweZVJSooRnm3GvEEFKPW+mH+40Tcp5oJB1JVCYrIBY+/ZSICxe0zY5VkQ Y3u7OGo1bY8CcNS/xxNGUUdSz2X4rIkgr3Z7+AqKb4rEH51va+J8rsLvlMctYALmYpL1f4 KGL97OKicdRnFjlOpGKxHdIM2RT3/8ZLR5E0m1dqqq7ZK1D3MVwQVdgf9Z/XnrJBMsphdm 8qkR/MGyMjw+hUZWh501ECVW4Pu5Ptu+sYQgzugBod5YVoASmSgVr1X80O/AYw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ED47D1C43D for ; Mon, 1 Apr 2024 22:51:10 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rrOcO-0005qL-NL; Mon, 01 Apr 2024 16:51:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rrOcN-0005px-2C for guix-patches@gnu.org; Mon, 01 Apr 2024 16:50:59 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rrOcM-0003tg-Pb for guix-patches@gnu.org; Mon, 01 Apr 2024 16:50:58 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rrOcP-00089L-QO for guix-patches@gnu.org; Mon, 01 Apr 2024 16:51:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62202] [PATCH v4 6/6] tests: juliahub: Add unit tests for (guix import juliahub). Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 01 Apr 2024 20:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch moreinfo To: Nicolas Graves Cc: zimoun.toutoune@gmail.com, 62202@debbugs.gnu.org Received: via spool by 62202-submit@debbugs.gnu.org id=B62202.171200465631286 (code B ref 62202); Mon, 01 Apr 2024 20:51:01 +0000 Received: (at 62202) by debbugs.gnu.org; 1 Apr 2024 20:50:56 +0000 Received: from localhost ([127.0.0.1]:51805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrOcJ-00088Y-Vq for submit@debbugs.gnu.org; Mon, 01 Apr 2024 16:50:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrOcG-00088J-JE for 62202@debbugs.gnu.org; Mon, 01 Apr 2024 16:50:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rrOc6-0003sI-3e; Mon, 01 Apr 2024 16:50:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=3wAsMFihu2Oqe/dqaKpP9L4a1pY5noKRPEU808jzaOo=; b=imyL+jKtUK6OhfCtMa/8 tDyMEV6nWu7QMjj+orCCPWNEp6me1zJ0TyukBCCsEazSP+Ba7SNYx2kzHvIXgvJPYtlNX5rQWOn25 7yF0J4QKG9ltINUah+L5vdsz9V/arDHiXScxoPn8xGK9sUFVxTNyaZEKZUX8ROnUWh1DnjAAVvHii Ndd2OkqYAhslasnmV5qR7emK2Eki2s1ajtM+drO1DFfeH64ig8cUdasYuK9AplvkvWOH888DI7sOY Zv51AlyMQk2AJYETm+4+gQIHalfYw7GXDmooIfoYI1F5nh9H+mOFCqIQBq10OLvVwSgkibAoj76Ct Q9XPjDiVXSXzpA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <20240203230807.25751-6-ngraves@ngraves.fr> (Nicolas Graves's message of "Sun, 4 Feb 2024 00:07:16 +0100") References: <20240203230807.25751-1-ngraves@ngraves.fr> <20240203230807.25751-6-ngraves@ngraves.fr> Date: Mon, 01 Apr 2024 22:50:39 +0200 Message-ID: <87plv8bye8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -7.05 X-Migadu-Queue-Id: ED47D1C43D X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -7.05 X-TUID: dwgsv6CBOXsx Hi, As part of this v4, I would recommend merging patches 2, 3, and 6, such that there=E2=80=99s a single self-contained patch adding =E2=80=98guix imp= ort juliahub=E2=80=99. (That=E2=80=99s what we usually do and I find it cleare= r because we immediately see what goes together.) Nicolas Graves skribis: > * tests/juliahub.scm : Add unit tests juliahub-redirect, > julia-general-registry-parsing, juliahub-fetch. Just =E2=80=9CNew file.=E2=80=9D Some of the other files lack a commit log; we can add it for you, but it=E2=80=99d be great if you could do it upfront. > --- > tests/juliahub.scm | 185 +++++++++++++++++++++++++++++++++++++++++++++ Please add it to =E2=80=98Makefile.am=E2=80=99. [...] > +(define (mock-http-fetch testcase) > + (lambda (url . rest) > + (let ((body (assoc-ref testcase url))) > + (if body > + (open-input-string body) > + (error "mocked http-fetch Unexpected URL: " url))))) > + > +(define (mock-http-get testcase) > + (lambda (url . rest) > + (let ((body (assoc-ref testcase url)) > + (response-header > + (build-response > + #:version '(1 . 1) I strongly encourage using =E2=80=98with-http-server=E2=80=99 using the sam= e strategy that=E2=80=99s used in =E2=80=98tests/pypi.scm=E2=80=99 and others instead = of mocking. (=E2=80=98mock=E2=80=99 is very sensitive to inlining, plus you sorta have to make assumptions about the code path to be able to mock the right things.) > +(test-equal "juliahub-fetch" > + #t > + (mock ((web client) http-get > + (mock-http-get fixtures-juliahub-check-test)) > + (mock ((guix http-client) http-fetch > + (mock-http-fetch fixtures-juliahub-check-test)) > + (mock ((guix import utils) git->origin mock-git->origin) > + ((@@ (guix import juliahub) juliahub-package?) > + ((@@ (guix import juliahub) juliahub-fetch) "MyPack= age")))))) Checking for =E2=80=98juliahub-package?=E2=80=99 doesn=E2=80=99t tell us mu= ch; what about checking the whole package, similar to what is done in other importer tests? Thanks, Ludo=E2=80=99.