Im trying to write some python unittest for the in...
# python
Im trying to write some python unittest for the infra. I have this snippet that read config from stack yaml :
Copy code
Get instance stack config
config_instance = pulumi.Config("instance")
config_instance = pulumi.Config("instance")
When I try to run tests I get:
Copy code
ERROR: test_core_stack (unittest.loader._FailedTest)
ImportError: Failed to import test module: test_core_stack
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/", line 377, in _get_module_from_name
  File "/Users/pawelmadon/git/a4b/poc/qx-pulumi/core-stack/", line 13, in <module>
    import core_stack
  File "/Users/pawelmadon/git/a4b/poc/qx-pulumi/core-stack/", line 54, in <module>
  File "/Users/pawelmadon/git/a4b/poc/qx-pulumi/core-stack/venv/lib/python3.7/site-packages/pulumi/", line 214, in require
    raise ConfigMissingError(self.full_key(key))
pulumi.config.ConfigMissingError: Missing required configuration variable 'instance:bastion_size'
    please set a value using the command `pulumi config set instance:bastion_size <value>`

Ran 1 test in 0.000s

FAILED (errors=1)
How I can import configuration to tests ?
We don't currently have a way to mock configuration, but Mikhail has provided a workaround for this at
📝 1
p 1
And how to mock stack reference and outputs from another stack ?