Set up each workflow test.
(self)
| 43 | cls.app.setQuitOnLastWindowClosed(False) |
| 44 | |
| 45 | def setUp(self): |
| 46 | """Set up each workflow test.""" |
| 47 | print(f"\n=== WORKFLOW TEST: {self._testMethodName} ===") |
| 48 | |
| 49 | # Create fresh application window |
| 50 | self.window = NodeEditorWindow() |
| 51 | self.graph = self.window.graph |
| 52 | self.view = self.window.view |
| 53 | |
| 54 | # Show window and prepare for testing |
| 55 | self.window.show() |
| 56 | self.window.resize(1400, 900) |
| 57 | self.window.raise_() |
| 58 | |
| 59 | # Clear any existing content completely |
| 60 | self.graph.clear_graph() |
| 61 | |
| 62 | # Clear command history to ensure clean state |
| 63 | if hasattr(self.graph, 'command_history'): |
| 64 | self.graph.command_history.clear() |
| 65 | |
| 66 | # Clear any selections that might interfere |
| 67 | if hasattr(self.graph, 'clearSelection'): |
| 68 | self.graph.clearSelection() |
| 69 | |
| 70 | # Reset view state |
| 71 | if hasattr(self.view, 'resetTransform'): |
| 72 | self.view.resetTransform() |
| 73 | |
| 74 | # Ensure all pending events are processed |
| 75 | QApplication.processEvents() |
| 76 | QTest.qWait(200) |
| 77 | |
| 78 | # Verify clean state |
| 79 | if len(self.graph.nodes) != 0 or len(self.graph.connections) != 0: |
| 80 | print(f"WARNING: Graph not properly cleared - nodes: {len(self.graph.nodes)}, connections: {len(self.graph.connections)}") |
| 81 | # Force clear again |
| 82 | self.graph.nodes.clear() |
| 83 | self.graph.connections.clear() |
| 84 | for item in list(self.graph.items()): |
| 85 | self.graph.removeItem(item) |
| 86 | QApplication.processEvents() |
| 87 | |
| 88 | print(f"Workflow environment ready") |
| 89 | |
| 90 | def tearDown(self): |
| 91 | """Clean up after workflow test.""" |
nothing calls this directly
no test coverage detected