In #67, we added support for Juju controller and model arguments, and added pytester based unit tests to exercise the CLI portion. There was some discussion about whether this was the right approach in the end. The key issue in this case is that whether the inner test passes or fails depends in a non-obvious way on exactly the right CLI args being passed.
Alternatives to what landed that we should consider:
- Make the inner tests aware of their arguments via
config.getoption and set their expected values to assert on accordingly. Call the inner tests multiple times with different CLI arguments.
- Just mock
request.config.getoption and have single layer tests in cases like this.
In #67, we added support for Juju controller and model arguments, and added
pytesterbased unit tests to exercise the CLI portion. There was some discussion about whether this was the right approach in the end. The key issue in this case is that whether the inner test passes or fails depends in a non-obvious way on exactly the right CLI args being passed.Alternatives to what landed that we should consider:
config.getoptionand set their expected values to assert on accordingly. Call the inner tests multiple times with different CLI arguments.request.config.getoptionand have single layer tests in cases like this.