Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E6D6C433F5 for ; Fri, 17 Sep 2021 09:26:07 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7BF38611C3 for ; Fri, 17 Sep 2021 09:26:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7BF38611C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRA8C-00014F-GY for qemu-devel@archiver.kernel.org; Fri, 17 Sep 2021 05:26:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRA78-00080z-AA for qemu-devel@nongnu.org; Fri, 17 Sep 2021 05:24:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57184) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRA75-0008TO-FO for qemu-devel@nongnu.org; Fri, 17 Sep 2021 05:24:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631870694; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=HCCryFqRMYI/G21nbklAoVM6qDB106t64bcJehRVe9o=; b=iQa5BzLKy8fOjaODCf9+piVDup3GscEtLwTO8QsFaoOU81G7fIjfLoLv5Mf/UyXgSnfgKH SzpOH0dD40biFZXnHbTfa+kaX1DoCJU+pRuVyJ2Mw/po29s75LIunIAnMC75X6KNxeJslq 2fVBzkcsl3TqHru0mjWN1Xhek/uDiUE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-O1gHXuQoOlGY9ALlZ-8n6g-1; Fri, 17 Sep 2021 05:24:53 -0400 X-MC-Unique: O1gHXuQoOlGY9ALlZ-8n6g-1 Received: by mail-wm1-f70.google.com with SMTP id 17-20020a05600c029100b00305eac9f29aso1619264wmk.1 for ; Fri, 17 Sep 2021 02:24:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=HCCryFqRMYI/G21nbklAoVM6qDB106t64bcJehRVe9o=; b=vFo4WCrxpMUdJBIo+8zjTKHpy/n5la+Boe5yOELqyuJ0BIZSsGOFJy2OosDjXT4X4d dHIr9gfTjjclBw7BWrU/BerN9K3eLdeKi9CFTblGLyRjKEbu5Km1vU6W//1laVKLbkVR 6zlmWeX770d6il35NZqr3rVlb2FOauCU532RGXFOYW4XAFQmUG3h7WOggQ8Uk6TM9JfG 30y02CE4lVKfi0SA52+K67eTtqWrGOmE07cWkG8AbVFLZcVWGdYBU8JHAHCXI1OYLTLv dlP8Gwerb/oegyFxWB9cGYEUKp31BlwFRcI0T5z+Qp/rzJEI7Tvh3HVkNrUmwfxt6tqV DrKA== X-Gm-Message-State: AOAM530S8VeJ/tjoHmG+tufpHaynVtvGa5450ApUlgWAIQUMIo30p9JD GvYkpRE49seOEYew1hTqzxnlK93bmVRfbqMlNLlfDE05yGHdGAo37Vuw06DiAHtKzl3CTYdsGtZ F1IbGDiorEGHZR0c= X-Received: by 2002:a05:600c:4e93:: with SMTP id f19mr14149190wmq.185.1631870691911; Fri, 17 Sep 2021 02:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQZ2Dx8AcRn2q5OgQgj8JGbt3FWIOzXXbks4WM/GXqKGcoA4MKEUVVFqRkZfJuACXnsJaKLA== X-Received: by 2002:a05:600c:4e93:: with SMTP id f19mr14149166wmq.185.1631870691681; Fri, 17 Sep 2021 02:24:51 -0700 (PDT) Received: from dresden.str.redhat.com ([2a02:908:1e48:3780:4451:9a65:d4e9:9bb6]) by smtp.gmail.com with ESMTPSA id u29sm3453824wru.34.2021.09.17.02.24.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Sep 2021 02:24:51 -0700 (PDT) Subject: Re: [PATCH v3 06/16] iotests/297: Add get_files() function To: John Snow , qemu-devel@nongnu.org References: <20210916040955.628560-1-jsnow@redhat.com> <20210916040955.628560-7-jsnow@redhat.com> From: Hanna Reitz Message-ID: Date: Fri, 17 Sep 2021 11:24:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210916040955.628560-7-jsnow@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Received-SPF: pass client-ip=170.10.133.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.488, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Eduardo Habkost , qemu-block@nongnu.org, Markus Armbruster , Cleber Rosa Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 16.09.21 06:09, John Snow wrote: > Split out file discovery into its own method to begin separating out the > "environment setup" and "test execution" phases. > > Signed-off-by: John Snow > --- > tests/qemu-iotests/297 | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 > index 3e86f788fc..b3a56a3a29 100755 > --- a/tests/qemu-iotests/297 > +++ b/tests/qemu-iotests/297 > @@ -21,6 +21,7 @@ import re > import shutil > import subprocess > import sys > +from typing import List > > import iotests > > @@ -56,10 +57,15 @@ def is_python_file(filename: str, directory: str = '.') -> bool: > return False > > > +def get_test_files(directory: str = '.') -> List[str]: > + named_test_dir = os.path.join(directory, 'tests') > + named_tests = [f"tests/{entry}" for entry in os.listdir(named_test_dir)] > + check_tests = set(os.listdir(directory) + named_tests) - set(SKIP_FILES) > + return list(filter(lambda f: is_python_file(f, directory), check_tests)) Seeing a filter() makes me immensely happy, but I thought that was unpythonic? Reviewed-by: Hanna Reitz