New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix running LS for tests in the new in_memory_localstack plugin #9150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
if not session.config.option.start_localstack: | ||
LOG.info("Configuration option to start LocalStack not set.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we maybe invert the info, i.e., only log IF it is set? otherwise you'll see this every time you run unit,cli, or bootstrap tests, and that may be a bit misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this log was introduced, was that I had a hard time to debug why LS was not starting. In our case, because the config option was not set, but it could also have been that the plugin was not picked up, or some other reason.
If LocalStack would try to start, we should see that in the log anyway. However I see the issue with other tests.
What about a message like "LocalStack was not configured to start for this test suite"? Would that be less misleading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in slack, and agreed upon a message on module load, to log the plugin load.
Motivation
With #9139, we introduced a new way to start LS in tests, via a pytest plugin.
However, the hook chosen to start LS, and to check the configuration option, might be executed before the configuration option is set.
The configuration options are set in the
pytest_configure
hook, with the following definition:In community, this works, as the hook is specified in the initial conftest file, before the pytest_sessionstart hook is executed.
This, however, does not work if the test directory specified is a parent folder of the conftest file, as those will then only be imported during test collection,
pytest_sessionstart
takes place before test collection though.Changes