Fixture used in workspace related tests. Create and tear down a workspace *Use as a contextmanager*
()
| 129 | |
| 130 | @pytest.fixture() |
| 131 | def 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 | |
| 152 | class TestTerraform: |
no outgoing calls
no test coverage detected
searching dependent graphs…