An example of writing mock-based unit tests with both infrastructure definition and tests written in Python. The example uses the unittest test framework to define and run the tests.
-
Create a Python virtualenv, activate it, and install dependencies:
$ python3 -m venv venv $ source venv/bin/activate $ python -m pip install --upgrade pip $ python -m pip install -r requirements.txt
-
Run the tests:
$ python -m pytest # or simply `pytest` ------------------------------------------------------------ Ran 2 tests in 0.004s OK
Learn more about testing Pulumi programs: