From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id AIr5JsbuFGYqgQEAqHPOHw:P1 (envelope-from ) for ; Tue, 09 Apr 2024 09:31:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id AIr5JsbuFGYqgQEAqHPOHw (envelope-from ) for ; Tue, 09 Apr 2024 09:31:18 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; 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=1712647878; h=from:from:sender:sender:reply-to: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; bh=qJ+r4U5t8LryLRlUn7Agj2FJcjKgd/Vdb0hzyvx/ZyA=; b=KDShDiq6TaSbYxNvuGMvLVY/YMLM/j4GsTYHegr1b9Z5FwQB+uxPG5a15cpQSxY1i/zUQ2 dwqCGS8HqbBaPArZPGKkzoS5FVXKjaSJ/p4McUWWrW0TzNj44O/RfSPOvC8r4JIFGEZpim GpguW3/p8txNh6rvbD9U21Z76RtyYltYpHW2eOXaCG40KjDz7j7abm8pi9AGFHS4D2N578 hybyJhrfz6cpRTsqAyVD3Xz6e380IgtQVMP5vF6VvDYch6AarsUHIIyr5GWZx+NJWokdGc O7NItnSfd4wXzQr0XWLYSLbHzbInv4r5oEQtwtWIZNY5KxYpqQoEk6zpnt9k5A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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=1712647878; a=rsa-sha256; cv=none; b=i0Sdv8Tezdkw0wjDMhblXkmKKgnByQ/I3IYdxL9+MUNQVWxqVf5jweJ2TAyBzhEpuNDg1F F8s7FOjWX7pUGmk5YX7+JeCfo6ktecjriLb41NjHwbwlo4TjoZ+k5C4psQerOGImxqzBqR 3F4r3aDkQ7J+EQwQ649cj+xMgZOgzvbMB2SKSlptzuD8NhqHnXQzzOTd7vyPM9wRunXUYB yzcD3/mdcrkhzm8RXdvvpKBfenACp4FaRXDpgsA50d8mS48Oy5+mZ2n4DbWf53yfPXboyz 8mQXZrAagnaZwoHKnN4QTCZPR537E5XqmHJ1HbzdmBmjGNMYjOt2FiW0vpWFKA== 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 2A8093E900 for ; Tue, 09 Apr 2024 09:31:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ru5wk-00069e-T2; Tue, 09 Apr 2024 03:31:10 -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 1ru5wV-00066F-Rv for guix-patches@gnu.org; Tue, 09 Apr 2024 03:31:03 -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 1ru5wV-0001OA-4b for guix-patches@gnu.org; Tue, 09 Apr 2024 03:30:55 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ru5wc-0006Rv-Q3 for guix-patches@gnu.org; Tue, 09 Apr 2024 03:31:02 -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: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Apr 2024 07:31:02 +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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: zimoun.toutoune@gmail.com, 62202@debbugs.gnu.org Received: via spool by 62202-submit@debbugs.gnu.org id=B62202.171264782024459 (code B ref 62202); Tue, 09 Apr 2024 07:31:02 +0000 Received: (at 62202) by debbugs.gnu.org; 9 Apr 2024 07:30:20 +0000 Received: from localhost ([127.0.0.1]:48169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ru5vs-0006M0-Sy for submit@debbugs.gnu.org; Tue, 09 Apr 2024 03:30:19 -0400 Received: from 9.mo550.mail-out.ovh.net ([178.32.108.172]:35339) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ru5vn-0006Ky-HH for 62202@debbugs.gnu.org; Tue, 09 Apr 2024 03:30:15 -0400 Received: from director7.ghost.mail-out.ovh.net (unknown [10.109.176.8]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id 4VDHfd4pVLz1BRl for <62202@debbugs.gnu.org>; Tue, 9 Apr 2024 07:30:01 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-xgx6q (unknown [10.110.96.108]) by director7.ghost.mail-out.ovh.net (Postfix) with ESMTPS id E866E1FEAC; Tue, 9 Apr 2024 07:30:00 +0000 (UTC) Received: from ngraves.fr ([37.59.142.107]) by ghost-submission-6684bf9d7b-xgx6q with ESMTPSA id LA7/NHjuFGZa9AcAA0oNkw (envelope-from ); Tue, 09 Apr 2024 07:30:00 +0000 X-OVh-ClientIp: 81.67.146.208 In-Reply-To: <87plv8bye8.fsf@gnu.org> References: <20240203230807.25751-1-ngraves@ngraves.fr> <20240203230807.25751-6-ngraves@ngraves.fr> <87plv8bye8.fsf@gnu.org> Date: Tue, 09 Apr 2024 09:29:59 +0200 Message-ID: <87bk6jdmdk.fsf@ngraves.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 17183765854406500967 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrudegkedgleehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkgggtgfesthhqredttddtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeeuuefgkeeujeeiheeftdfggffggefgfeeljeevhfeuffefjeetheeivefguefhleenucffohhmrghinhephhhtthhpqdhfvghttghhuhhnvgigphgvtghtvgguuhhrlhhurhhluggvfhhinhgvmhhotghkqdhhthhtphdqghgvthhtvghsthgtrghsvghlrghmsggurghurhhlrdhrvghsthenucfkphepuddvjedrtddrtddruddpkedurdeijedrudegiedrvddtkedpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepiedvvddtvdesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheehtddpmhhouggvpehsmhhtphhouhht 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: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via 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-Migadu-Spam-Score: -6.87 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -6.87 X-Migadu-Queue-Id: 2A8093E900 X-TUID: wAxpPKwO+UqD On 2024-04-01 22:50, Ludovic Court=C3=A8s wrote: > 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 i= mport > juliahub=E2=80=99. (That=E2=80=99s what we usually do and I find it clea= rer 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 s= ame strategy > that=E2=80=99s used in =E2=80=98tests/pypi.scm=E2=80=99 and others instea= d 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.) I can't however mock a git server, right? I still must mock at least the git repo instead of getting it through a custom server, or is there a better solution here? > >> +(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) "MyPac= kage")))))) > > Checking for =E2=80=98juliahub-package?=E2=80=99 doesn=E2=80=99t tell us = much; what about > checking the whole package, similar to what is done in other importer > tests? > > Thanks, > Ludo=E2=80=99. --=20 Best regards, Nicolas Graves