You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ordering of teardown steps seem to be the other way around
-all blocks of the outermost context get called twice for some reason
Example 1: just -each
from mamba import description, context, it, before, after, shared_context, included_context
with shared_context("A"):
with before.each:
print("A.BEFORE")
with after.each:
print("A.AFTER")
with shared_context("B"):
with before.each:
print("B.BEFORE")
with after.each:
print("B.AFTER")
with description("Example") as self:
with included_context("A"):
with included_context("B"):
with it("IT"):
print("IT")
Expected:
A.BEFORE
B.BEFORE
IT
B.AFTER
A.AFTER
Actual:
A.BEFORE
B.BEFORE
IT
A.AFTER
B.AFTER
Example 2: just -all
from mamba import description, context, it, before, after, shared_context, included_context
with shared_context("A"):
with before.all:
print("A.BEFORE")
with after.all:
print("A.AFTER")
with shared_context("B"):
with before.all:
print("B.BEFORE")
with after.all:
print("B.AFTER")
with description("Data extraction") as self:
with included_context("A"):
with included_context("B"):
with it("IT"):
print("IT")
Expected:
A.BEFORE
B.BEFORE
IT
B.AFTER
A.AFTER
Actual:
A.BEFORE
A.BEFORE
B.BEFORE
IT
A.AFTER
B.AFTER
A.AFTER
Example 3: -each and -all
from mamba import description, context, it, before, after, shared_context, included_context
with shared_context("A"):
with before.each:
print("A.BEFORE.EACH")
with after.each:
print("A.AFTER.EACH")
with before.all:
print("A.BEFORE.ALL")
with after.all:
print("A.AFTER.ALL")
with shared_context("B"):
with before.each:
print("B.BEFORE.EACH")
with after.each:
print("B.AFTER.EACH")
with before.all:
print("B.BEFORE.ALL")
with after.all:
print("B.AFTER.ALL")
with description("Data extraction") as self:
with included_context("A"):
with included_context("B"):
with it("IT"):
print("IT")
Expected:
A.BEFORE.ALL
B.BEFORE.ALL
A.BEFORE.EACH
B.BEFORE.EACH
IT
B.AFTER.EACH
A.AFTER.EACH
B.AFTER.ALL
A.AFTER.ALL
Actually, even for normal context, the ordering is wrong:
from mamba import description, context, it, before, after, shared_context, included_context
with description("Data extraction") as self:
with context("A"):
with before.each:
print("A.BEFORE")
with after.each:
print("A.AFTER")
with context("B"):
with before.each:
print("B.BEFORE")
with after.each:
print("B.AFTER")
with it("IT"):
print("IT")
Results are same as for included contexts in this case
I think there are two issues:
Example 1: just -each
Expected:
Actual:
Example 2: just -all
Expected:
Actual:
Example 3: -each and -all
Expected:
Actual:
The text was updated successfully, but these errors were encountered: