feat: Add flag to clean up postgres databases. #204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #202.
cleanup_databases=False
argument. Default False to retain original behaviorcreate_postgres_fixture
callIt probably makes sense to follow this up with a
pmr --cleanup
or the like kind of CLI extension, that more directly just deletes allpmr_*
named databases. If there's a hard test failure, you enter a debugger and exit uncleanly, you ctrl+c enough, or various other means: it's still fairly straightforward to end up with left over databases.1 unresolved issue:
pytest-asyncio has all sorts of weird stuff going on in both prior versions that people claim works, and the new versions are just broken apparently. In either case, I wasn't able to find a way that seemed to work reliably in async code (at least, using pytest-asyncio). Only affecting template database cleanup.
So unless/until there's a different plugin, or they resolve their stuff and we start requiring a much more recent minimum version bound for it after they do, template database cleanup will mean that async code wont share templates (and thus will be slower). Could be worse, but isn't ideal.