Provides a timeline factory. All timelines created by this factory are automatically finalized and checked for basic consistency after the end of the test.
(request)
| 32 | |
| 33 | @pytest.fixture |
| 34 | def make_timeline(request): |
| 35 | """Provides a timeline factory. All timelines created by this factory |
| 36 | are automatically finalized and checked for basic consistency after the |
| 37 | end of the test. |
| 38 | """ |
| 39 | |
| 40 | timelines = [] |
| 41 | |
| 42 | def factory(): |
| 43 | timeline = Timeline() |
| 44 | timelines.append(timeline) |
| 45 | with timeline.frozen(): |
| 46 | assert timeline.beginning is not None |
| 47 | initial_history = [some.object.same_as(timeline.beginning)] |
| 48 | assert timeline.history() == initial_history |
| 49 | return timeline, initial_history |
| 50 | |
| 51 | yield factory |
| 52 | log.newline() |
| 53 | |
| 54 | try: |
| 55 | failed = request.node.call_result.failed |
| 56 | except AttributeError: |
| 57 | pass |
| 58 | else: |
| 59 | if not failed: |
| 60 | for timeline in timelines: |
| 61 | timeline.finalize() |
| 62 | history = timeline.history() |
| 63 | history.sort(key=lambda occ: occ.timestamp) |
| 64 | assert history == timeline.history() |
| 65 | assert history[-1] == Mark("FINISH") |
| 66 | timeline.close() |
| 67 | |
| 68 | |
| 69 | @pytest.mark.timeout(1) |
no test coverage detected
searching dependent graphs…