Reputation: 25842
I have several update functions. They must be executed in strict order.
For example
def update1(a1):
do_something...
def update2(a1, a2):
do_something...
def update3(a1):
do_something...
def process(a,b):
update1(a)
update2(a,b)
update3(a)
In process
, all update
functions must be executed in that order.
How to write a unit test to test the order of the executions inside process
?
I am not asking the execution order of tests, not like these questions
Python unittest.TestCase execution order
Execution order on python unittest
Upvotes: 0
Views: 256
Reputation: 42778
Ask yourself the question, "why is the order important?" If you can't tell from outside the difference of calls, you don't have to test them. If these are for example database updates you have to write a database mockup which logs the order of updates, or make a select statement, that can check, if the updates ocured in the correct order.
Upvotes: 3