Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-31 Thread Stefan Hajnoczi
On Thu, Aug 24, 2017 at 08:21:59AM +0100, Stefan Hajnoczi wrote: > This series introduces context managers for the two most commonly used > resources: files and VMs. Context managers eliminate the need to call a > cleanup function explicitly. > > Tests should declare resources upfront in a with

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-30 Thread Fam Zheng
On Wed, 08/30 13:44, Stefan Hajnoczi wrote: > On Fri, Aug 25, 2017 at 05:29:14PM +0800, Fam Zheng wrote: > > On Fri, 08/25 09:52, Stefan Hajnoczi wrote: > > > On Fri, Aug 25, 2017 at 03:32:29PM +0800, Fam Zheng wrote: > > > > On Thu, 08/24 19:04, Stefan Hajnoczi wrote: > > > > > On Thu, Aug 24,

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-30 Thread Stefan Hajnoczi
On Fri, Aug 25, 2017 at 05:29:14PM +0800, Fam Zheng wrote: > On Fri, 08/25 09:52, Stefan Hajnoczi wrote: > > On Fri, Aug 25, 2017 at 03:32:29PM +0800, Fam Zheng wrote: > > > On Thu, 08/24 19:04, Stefan Hajnoczi wrote: > > > > On Thu, Aug 24, 2017 at 04:38:43PM +0800, Fam Zheng wrote: > > > > > On

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-28 Thread Markus Armbruster
Stefan Hajnoczi writes: > On Fri, Aug 25, 2017 at 03:32:29PM +0800, Fam Zheng wrote: >> On Thu, 08/24 19:04, Stefan Hajnoczi wrote: >> > On Thu, Aug 24, 2017 at 04:38:43PM +0800, Fam Zheng wrote: >> > > On Thu, 08/24 08:21, Stefan Hajnoczi wrote: >> > > > Tests should

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-25 Thread Fam Zheng
On Fri, 08/25 09:52, Stefan Hajnoczi wrote: > On Fri, Aug 25, 2017 at 03:32:29PM +0800, Fam Zheng wrote: > > On Thu, 08/24 19:04, Stefan Hajnoczi wrote: > > > On Thu, Aug 24, 2017 at 04:38:43PM +0800, Fam Zheng wrote: > > > > On Thu, 08/24 08:21, Stefan Hajnoczi wrote: > > > > > Tests should

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-25 Thread Stefan Hajnoczi
On Fri, Aug 25, 2017 at 03:32:29PM +0800, Fam Zheng wrote: > On Thu, 08/24 19:04, Stefan Hajnoczi wrote: > > On Thu, Aug 24, 2017 at 04:38:43PM +0800, Fam Zheng wrote: > > > On Thu, 08/24 08:21, Stefan Hajnoczi wrote: > > > > Tests should declare resources upfront in a with statement. Resources

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-25 Thread Fam Zheng
On Thu, 08/24 19:04, Stefan Hajnoczi wrote: > On Thu, Aug 24, 2017 at 04:38:43PM +0800, Fam Zheng wrote: > > On Thu, 08/24 08:21, Stefan Hajnoczi wrote: > > > Tests should declare resources upfront in a with statement. Resources are > > > automatically cleaned up whether the test passes or fails:

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-24 Thread Stefan Hajnoczi
On Thu, Aug 24, 2017 at 04:38:43PM +0800, Fam Zheng wrote: > On Thu, 08/24 08:21, Stefan Hajnoczi wrote: > > Tests should declare resources upfront in a with statement. Resources are > > automatically cleaned up whether the test passes or fails: > > > > with FilePath('test.img') as img_path, >

Re: [Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-24 Thread Fam Zheng
On Thu, 08/24 08:21, Stefan Hajnoczi wrote: > Tests should declare resources upfront in a with statement. Resources are > automatically cleaned up whether the test passes or fails: > > with FilePath('test.img') as img_path, >VM() as vm: > ...test... > # img_path is deleted and

[Qemu-devel] [PATCH 0/3] iotests: clean up resources using context managers

2017-08-24 Thread Stefan Hajnoczi
This series introduces context managers for the two most commonly used resources: files and VMs. Context managers eliminate the need to call a cleanup function explicitly. Tests should declare resources upfront in a with statement. Resources are automatically cleaned up whether the test passes