Refactor test to ensure file is closed
Refactor test to ensure file is closed

Python requires parentheses to call a method. Without parentheses it
will return the method object which doesn't do anything useful without
an lvalue.

Since we're in here, switch it to be a context manager to be shorter
while making sure the file gets closed.

Change-Id: Ib8b15e286c8bbca1f59c530c9200cb7a781c3d6b

akash1808/nova,fnordahl/nova,BeyondTheClouds/nova,ted-gould/nova,vmturbo/nova,yatinkumbhare/openstack-nova,eayunstack/nova,jianghuaw/nova,saleemjaveds/https-github.com-openstack-nova,raildo/nova,LoHChina/nova,vmturbo/nova,maelnor/nova,cloudbase/nova,ruslanloman/nova,gooddata/openstack-nova,viggates/nova,barnsnake351/nova,tangfeixiong/nova,BeyondTheClouds/nova,Metaswitch/calico-nova,jeffrey4l/nova,whitepages/nova,sebrandon1/nova,dims/nova,devendermishrajio/nova_test_latest,openstack/nova,Stavitsky/nova,sebrandon1/nova,Tehsmash/nova,JioCloud/nova,petrutlucian94/nova,Juniper/nova,cloudbase/nova-virtualbox,openstack/nova,Tehsmash/nova,isyippee/nova,isyippee/nova,TwinkleChawla/nova,cloudbase/nova-virtualbox,zzicewind/nova,bigswitch/nova,dawnpower/nova,Francis-Liu/animated-broccoli,adelina-t/nova,joker946/nova,badock/nova,tianweizhang/nova,apporc/nova,iuliat/nova,cernops/nova,raildo/nova,vmturbo/nova,double12gzh/nova,phenoxim/nova,gooddata/openstack-nova,varunarya10/nova_test_latest,sebrandon1/nova,shail2810/nova,bgxavier/nova,JianyuWang/nova,shail2810/nova,tangfeixiong/nova,CloudServer/nova,vladikr/nova_drafts,takeshineshiro/nova,whitepages/nova,mikalstill/nova,silenceli/nova,devendermishrajio/nova,mikalstill/nova,fnordahl/nova,gooddata/openstack-nova,Juniper/nova,vladikr/nova_drafts,thomasem/nova,affo/nova,virtualopensystems/nova,mmnelemane/nova,NeCTAR-RC/nova,belmiromoreira/nova,petrutlucian94/nova,gooddata/openstack-nova,rajalokan/nova,silenceli/nova,eonpatapon/nova,Metaswitch/calico-nova,felixma/nova,mandeepdhami/nova,Stavitsky/nova,tudorvio/nova,Yusuke1987/openstack_template,scripnichenko/nova,scripnichenko/nova,mikalstill/nova,noironetworks/nova,Yusuke1987/openstack_template,virtualopensystems/nova,double12gzh/nova,yosshy/nova,bigswitch/nova,mgagne/nova,affo/nova,berrange/nova,klmitch/nova,zaina/nova,mandeepdhami/nova,JioCloud/nova_test_latest,mahak/nova,badock/nova,ruslanloman/nova,openstack/nova,TwinkleChawla/nova,MountainWei/nova,rajalokan/nova,alexandrucoman/vbox-nova-driver,bgxavier/nova,watonyweng/nova,j-carpentier/nova,rahulunair/nova,phenoxim/nova,takeshineshiro/nova,belmiromoreira/nova,rajalokan/nova,mahak/nova,NeCTAR-RC/nova,kimjaejoong/nova,klmitch/nova,zhimin711/nova,dims/nova,mgagne/nova,redhat-openstack/nova,kimjaejoong/nova,tealover/nova,yatinkumbhare/openstack-nova,edulramirez/nova,akash1808/nova_test_latest,jianghuaw/nova,eonpatapon/nova,iuliat/nova,joker946/nova,Juniper/nova,alvarolopez/nova,JioCloud/nova_test_latest,barnsnake351/nova,klmitch/nova,MountainWei/nova,vmturbo/nova,alaski/nova,zhimin711/nova,orbitfp7/nova,rahulunair/nova,blueboxgroup/nova,mahak/nova,CCI-MOC/nova,j-carpentier/nova,nikesh-mahalka/nova,nikesh-mahalka/nova,noironetworks/nova,thomasem/nova,hanlind/nova,blueboxgroup/nova,projectcalico/calico-nova,CEG-FYP-OpenStack/scheduler,berrange/nova,akash1808/nova,tianweizhang/nova,mmnelemane/nova,devendermishrajio/nova_test_latest,varunarya10/nova_test_latest,CEG-FYP-OpenStack/scheduler,CCI-MOC/nova,zzicewind/nova,JianyuWang/nova,BeyondTheClouds/nova,dawnpower/nova,alexandrucoman/vbox-nova-driver,zaina/nova,Francis-Liu/animated-broccoli,watonyweng/nova,akash1808/nova_test_latest,CloudServer/nova,cloudbase/nova,ted-gould/nova,orbitfp7/nova,yosshy/nova,cernops/nova,rahulunair/nova,devendermishrajio/nova,jianghuaw/nova,jeffrey4l/nova,LoHChina/nova,alaski/nova,cyx1231st/nova,klmitch/nova,JioCloud/nova,cloudbase/nova,cyx1231st/nova,projectcalico/calico-nova,felixma/nova,rajalokan/nova,Juniper/nova,adelina-t/nova,saleemjaveds/https-github.com-openstack-nova,alvarolopez/nova,maelnor/nova,angdraug/nova,cernops/nova,apporc/nova,redhat-openstack/nova,edulramirez/nova,eayunstack/nova,jianghuaw/nova,viggates/nova,hanlind/nova,hanlind/nova,angdraug/nova,tealover/nova,tudorvio/nova