MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_order_of_execution

Method test_order_of_execution

testing/test_session.py:180–204  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

178
179class TestNewSession(SessionTests):
180 def test_order_of_execution(self, pytester: Pytester) -> None:
181 reprec = pytester.inline_runsource(
182 """
183 values = []
184 def test_1():
185 values.append(1)
186 def test_2():
187 values.append(2)
188 def test_3():
189 assert values == [1,2]
190 class Testmygroup(object):
191 reslist = values
192 def test_1(self):
193 self.reslist.append(1)
194 def test_2(self):
195 self.reslist.append(2)
196 def test_3(self):
197 self.reslist.append(3)
198 def test_4(self):
199 assert self.reslist == [1,2,1,2,3]
200 """
201 )
202 passed, skipped, failed = reprec.countoutcomes()
203 assert failed == skipped == 0
204 assert passed == 7
205
206 def test_collect_only_with_various_situations(self, pytester: Pytester) -> None:
207 p = pytester.makepyfile(

Callers

nothing calls this directly

Calls 2

countoutcomesMethod · 0.80
inline_runsourceMethod · 0.45

Tested by

no test coverage detected