Re: [openstack-dev] [cinder] How to make a mock effactive for all method of a testclass

2015-09-24 Thread Gorka Eguileor
On 23/09, Eric Harney wrote: > On 09/23/2015 04:06 AM, liuxinguo wrote: > > Hi, > > > > In a.py we have a function: > > def _change_file_mode(filepath): > > utils.execute('chmod', '600', filepath, run_as_root=True) > > > > In test_xxx.py, there is a testclass: > > class

Re: [openstack-dev] [cinder] How to make a mock effactive for all method of a testclass

2015-09-23 Thread Eric Harney
On 09/23/2015 04:06 AM, liuxinguo wrote: > Hi, > > In a.py we have a function: > def _change_file_mode(filepath): > utils.execute('chmod', '600', filepath, run_as_root=True) > > In test_xxx.py, there is a testclass: > class DriverTestCase(test.TestCase): > def test_a(self) > ... >

Re: [openstack-dev] [cinder] How to make a mock effactive for all method of a testclass

2015-09-23 Thread Brant Knudson
On Wed, Sep 23, 2015 at 3:06 AM, liuxinguo wrote: > Hi, > > > > In a.py we have a function: > > def *_change_file_mode*(filepath): > > utils.execute(*'chmod'*, *'600'*, filepath, run_as_root=True) > > > > In test_xxx.py, there is a testclass: > > clas*s

Re: [openstack-dev] [cinder] How to make a mock effactive for all method of a testclass

2015-09-23 Thread Gorka Eguileor
On 23/09, liuxinguo wrote: > Hi, > > In a.py we have a function: > def _change_file_mode(filepath): > utils.execute('chmod', '600', filepath, run_as_root=True) > > In test_xxx.py, there is a testclass: > class DriverTestCase(test.TestCase): > def test_a(self) > ... > Call a.

[openstack-dev] [cinder] How to make a mock effactive for all method of a testclass

2015-09-23 Thread liuxinguo
Hi, In a.py we have a function: def _change_file_mode(filepath): utils.execute('chmod', '600', filepath, run_as_root=True) In test_xxx.py, there is a testclass: class DriverTestCase(test.TestCase): def test_a(self) ... Call a. _change_file_mode ... def test_b(self) ... Call