MCPcopy Create free account
hub / github.com/beelit94/python-terraform / workspace_setup_teardown

Function workspace_setup_teardown

test/test_terraform.py:131–149  ·  view source on GitHub ↗

Fixture used in workspace related tests. Create and tear down a workspace *Use as a contextmanager*

()

Source from the content-addressed store, hash-verified

129
130@pytest.fixture()
131def workspace_setup_teardown():
132 """Fixture used in workspace related tests.
133
134 Create and tear down a workspace
135 *Use as a contextmanager*
136 """
137
138 @contextmanager
139 def wrapper(workspace_name, create=True, delete=True, *args, **kwargs):
140 tf = Terraform(working_dir=current_path)
141 tf.init()
142 if create:
143 tf.create_workspace(workspace_name, *args, **kwargs)
144 yield tf
145 if delete:
146 tf.set_workspace("default")
147 tf.delete_workspace(workspace_name)
148
149 yield wrapper
150
151
152class TestTerraform:

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…