qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] qemu-iotests: Test 0-length image for mirro


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 3/3] qemu-iotests: Test 0-length image for mirror
Date: Thu, 5 Jun 2014 13:26:48 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]