pulumi/sdk/python/lib/test/automation
Julien 43a9bd7fe6
Catch BaseException in automation API server (#17909)
Automation API is useful for writing tests for Pulumi programs, and a
user could write a test as follows:

```python
def program():
    with pytest.raises(ValueError):
        _a = 1 + 2  # No error here, pytest.raises should fail

stack = create_stack("mystack", program=program, project_name="proj")

with pytest.raises(InlineSourceRuntimeError):
    stack.preview()
```

If the block in `pytest.raises` does not raise the expected error or any
error, `pytest.raises` fails the test by raising an `OutcomeException`.
This exception class inherits from `BaseException`, not `Exception`, so
we would previously not catch this, and fail to report an error from the
automation API server's `Run` method, causing the call to
`stack.preview`
to hang indefinitely.

Fixes https://github.com/pulumi/pulumi/issues/17133
2024-12-03 15:47:58 +00:00
..
data [python/automation] Implement Stack.import_resources() for batch importing resources into a stack (#16668) 2024-07-24 14:58:34 +00:00
errors Regenerate test `package-lock.json` files (#16387) 2024-06-13 10:52:59 +00:00
__init__.py [Automation API] Python Implementation (#5979) 2021-01-12 16:55:59 -08:00
test_cmd.py [auto/python] Add new API to install the Pulumi CLI (#15204) 2024-01-26 14:30:19 +00:00
test_errors.py Use black to format lib/test (#16028) 2024-04-23 08:29:58 +00:00
test_isolation.py Use black to format lib/test (#16028) 2024-04-23 08:29:58 +00:00
test_local_workspace.py Catch BaseException in automation API server (#17909) 2024-12-03 15:47:58 +00:00
test_project_settings.py Fix YAML serialization of project settings in the Python Automation API (#16660) 2024-07-16 10:00:05 +00:00
test_remote_workspace.py Use black to format lib/test (#16028) 2024-04-23 08:29:58 +00:00
test_stack.py Use black to format lib/test (#16028) 2024-04-23 08:29:58 +00:00
test_utils.py Use black to format lib/test (#16028) 2024-04-23 08:29:58 +00:00