GeezerVison is showing github.com — Workspace(fix[importers]): Assert importer warnings on schema fields · tmux-python/tmuxp@a8750be
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/tmuxp/workspace/importers.py +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -268,10 +268,15 @@ def import_tmuxinator( |
268 | 268 | and tmuxp_workspace[socket_key] != explicit_value |
269 | 269 | ): |
270 | 270 | logger.warning( |
271 | | - "explicit %s %s overrides tmux option value %s", |
| 271 | + "explicit %s %s overrode tmux option value %s", |
272 | 272 | socket_key, |
273 | 273 | explicit_value, |
274 | 274 | tmuxp_workspace[socket_key], |
| 275 | + extra={ |
| 276 | + "tmux_session": str( |
| 277 | + tmuxp_workspace.get("session_name") or "", |
| 278 | + ), |
| 279 | + }, |
275 | 280 | ) |
276 | 281 | tmuxp_workspace[socket_key] = explicit_value |
277 | 282 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: tests/workspace/test_import_teamocil.py +12-2Lines changed: 12 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -240,5 +240,15 @@ def test_import_teamocil_warns_and_drops_pane_dimensions( |
240 | 240 | result = importers.import_teamocil(workspace) |
241 | 241 |
|
242 | 242 | assert result["windows"][0]["panes"] == [{"shell_command": "vim"}] |
243 | | - assert any("width" in record.message for record in caplog.records) |
244 | | - assert any("height" in record.message for record in caplog.records) |
| 243 | + dropped = [ |
| 244 | + record |
| 245 | + for record in caplog.records |
| 246 | + if record.levelno == logging.WARNING and hasattr(record, "tmux_window") |
| 247 | + ] |
| 248 | + dropped_keys = sorted( |
| 249 | + str(record.args[0]) |
| 250 | + for record in dropped |
| 251 | + if isinstance(record.args, tuple) and record.args |
| 252 | + ) |
| 253 | + assert dropped_keys == ["height", "width"] |
| 254 | + assert all(record.tmux_window == "main" for record in dropped) |
Collapse file
Copy file name to clipboardExpand all lines: tests/workspace/test_import_tmuxinator.py +8-2Lines changed: 8 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -274,8 +274,14 @@ def test_import_tmuxinator_socket_name_conflict_warns( |
274 | 274 | result = importers.import_tmuxinator(workspace) |
275 | 275 |
|
276 | 276 | assert result["socket_name"] == "explicit" |
277 | | - assert any("explicit" in record.message for record in caplog.records) |
278 | | - assert any("from_cli" in record.message for record in caplog.records) |
| 277 | + conflict_warnings = [ |
| 278 | + record |
| 279 | + for record in caplog.records |
| 280 | + if record.levelno == logging.WARNING and hasattr(record, "tmux_session") |
| 281 | + ] |
| 282 | + assert len(conflict_warnings) == 1 |
| 283 | + assert conflict_warnings[0].tmux_session == "conflict" |
| 284 | + assert conflict_warnings[0].args == ("socket_name", "explicit", "from_cli") |
279 | 285 |
|
280 | 286 |
|
281 | 287 | def test_import_tmuxinator_attached_tmux_flags() -> None: |
|