From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsVp3-000421-IS for qemu-devel@nongnu.org; Thu, 05 Jun 2014 07:27:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsVoq-0004kP-4s for qemu-devel@nongnu.org; Thu, 05 Jun 2014 07:27:05 -0400 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:64544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsVop-0004jJ-U0 for qemu-devel@nongnu.org; Thu, 05 Jun 2014 07:26:52 -0400 Received: by mail-wg0-f51.google.com with SMTP id x13so929478wgg.10 for ; Thu, 05 Jun 2014 04:26:51 -0700 (PDT) Date: Thu, 5 Jun 2014 13:26:48 +0200 From: Stefan Hajnoczi Message-ID: <20140605112648.GK27366@stefanha-thinkpad.redhat.com> References: <1401939756-11150-1-git-send-email-famz@redhat.com> <1401939756-11150-4-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1401939756-11150-4-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] qemu-iotests: Test 0-length image for mirror List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , jcody@redhat.com, qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , Paolo Bonzini On Thu, Jun 05, 2014 at 11:42:36AM +0800, Fam Zheng wrote: > +class TestSingleDriveZeroLength(TestSingleDrive): > + def setUp(self): > + TestSingleDrive.image_len = 0 > + return TestSingleDrive.setUp(self) This is buggy since it assigns to TestSingleDrive.image_len. It modifies the class variable for everyone else! I think we need something like this instead: >>> class Foo(object): ... a = 1 ... def test(self): ... return self.a ... >>> Foo().a 1 >>> Foo().test() 1 >>> class Bar(Foo): ... a = 2 ... >>> Bar().a 2 >>> Bar().test() 2 Please also fix the previous patch. It uses the same pattern.