pyforge icon indicating copy to clipboard operation
pyforge copied to clipboard

Allow nested ordering and interleaved order

Open yalon opened this issue 12 years ago • 0 comments

Enhance the ordering groups to allow nesting, and create a new "interleaved" order group.

Nesting is helpful to allow for a more modular test code - you can write methods that create a group of functions that execute in some order.

group1 = EnforceSequentialOrder()
with group1:
  foo1()
  foo2()

# This will append to the same group
with group1:
  foo3()
  foo4()

# This will create a group that doesn't care about order:
group2 = UnorderdGroup()
with group2:
  bar1()
  bar2()

# Now we can do this:

with AllowInterleavedOrder():
  group1()
  group2()

# This means that the following is valid:
#1. foo1, foo2, bar1, foo3, foo4, bar2
#2. bar2, foo1, bar1, foo2, foo3, foo4
#
# This is invalid:
#1. foo2, foo1, ...
#2. missing bar
# ...
#  You get the picture :)

yalon avatar Aug 22 '12 15:08 yalon