Skip to content

Add context manager support to Hosts class#45

Merged
igormilovanovic merged 1 commit intomasterfrom
feature/context-manager-33
Feb 20, 2026
Merged

Add context manager support to Hosts class#45
igormilovanovic merged 1 commit intomasterfrom
feature/context-manager-33

Conversation

@igormilovanovic
Copy link
Owner

Summary

  • Added __enter__ and __exit__ methods to Hosts class
  • Auto-saves on clean exit, skips save if exception occurs
  • Enables with Hosts() as h: pattern

Closes #33

Test plan

  • New test: context manager saves on clean exit
  • New test: context manager does NOT save on exception
  • All 66 tests pass locally

🤖 Generated with Claude Code

Support `with Hosts() as h:` pattern that auto-saves on clean exit.
No save occurs if an exception is raised inside the block.

Closes #33

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@igormilovanovic igormilovanovic merged commit 21a3130 into master Feb 20, 2026
14 checks passed
@igormilovanovic igormilovanovic deleted the feature/context-manager-33 branch February 20, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add context manager support to Hosts class

1 participant