openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #05649
Re: [nova-testing] Efforts for Essex
-
To:
Soren Hansen <soren@xxxxxxxxxxx>
-
From:
Sandy Walsh <sandy.walsh@xxxxxxxxxxxxx>
-
Date:
Wed, 23 Nov 2011 21:30:52 +0000
-
Accept-language:
en-US
-
Cc:
"openstack@xxxxxxxxxxxxxxxxxxx" <openstack@xxxxxxxxxxxxxxxxxxx>
-
In-reply-to:
<CAPFUtkatYMUVrXTDxd+6pwHyiYSL+DSjQc=+494txzckwE6wJg@mail.gmail.com>
-
Thread-index:
AQHMqE/4aazaGbageUyJH+XhrgaJWZW39r4AgADN6ACAAIVhgIAAPd8AgAAKkACAAAC0gIAAFU4A//+iv9qAAG7fgP//nQeagABp04D//778ugAOdbUAABchvlcAFYOZgP//oWcu
-
Thread-topic:
[Openstack] [nova-testing] Efforts for Essex
:) yeah, you're completely misunderstanding me.
So, you've made a much better StubOutWithMock() and slightly better stubs.Set() by (essentially) ignoring the method parameter checks and just focusing on the return type.
Using your example:
def test_something(self):
def fake_instance_get(context, instance_uuid):
return {'name': 'this or that',
'instance_type_id': 42}
self.stubs.Set(nova.db, 'instance_get_by_uuid', fake_instance_get)
exercise_the_routine_that_will_eventually_do_an_instance_get()
verify_that_the_system_is_now_in_the_desired_state()
Could your library be expanded to allow:
def test_something(self):
self.sorens_mox.Set(nova.db, 'instance_get_by_uuid', {'name': 'this or that',
'instance_type_id': 42})
self.sorens_mox.Set(nova.my_module, 'get_list_of_things', range(10))
exercise_the_routine_that_will_eventually_do_an_instance_get_and_get_list()
verify_that_the_system_is_now_in_the_desired_state()
See what I mean?
Side note:
I don't view tests that permit
exercise_the_routine_that_will_eventually_do_an_instance_get()
calls to be unit tests ... they're integration tests and the source of all this headache in the first place.
A unit test should be
exercise_the_routine_that_will_directly_call_instance_get()
Hopefully we're saying the same thing on this last point?
-S
________________________________________
From: Soren Hansen [soren@xxxxxxxxxxx]
Am I completely misunderstanding you?
Follow ups
References
-
[nova-testing] Efforts for Essex
From: Soren Hansen, 2011-11-21
-
Re: [nova-testing] Efforts for Essex
From: Kevin L. Mitchell, 2011-11-21
-
Re: [nova-testing] Efforts for Essex
From: Rohit Karajgi, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Soren Hansen, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Jay Pipes, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Kevin L. Mitchell, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Jay Pipes, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Soren Hansen, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Sandy Walsh, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Soren Hansen, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Sandy Walsh, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Soren Hansen, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Sandy Walsh, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Soren Hansen, 2011-11-22
-
Re: [nova-testing] Efforts for Essex
From: Sandy Walsh, 2011-11-23
-
Re: [nova-testing] Efforts for Essex
From: Soren Hansen, 2011-11-23