Skip to content
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

feat: Add cleanup_database option to postgres fixture. #219

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DanCardin
Copy link
Contributor

Note, this could potentially reveal preexisting issues in code under test, that could be perceived as a "breaking" change.

By deleting the database under test at the end of the test's execution, any database connections left connected to the database might cause the DELETE DATABASE command to fail.

PMR will try to use the WITH FORCE option on database versions >= 13.0, but that option does not exist on prior versions of postgres.

In any case, if this happens, it is ultimately revealing a "bug" in the code it is testing. Additionally, you can simply turn off database cleanup in one of various ways.

@DanCardin DanCardin force-pushed the dc/cleanup_database branch 3 times, most recently from 983cb82 to 609e488 Compare September 17, 2024 19:50
@coveralls
Copy link

coveralls commented Sep 18, 2024

Pull Request Test Coverage Report for Build 11132846749

Details

  • 37 of 38 (97.37%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 89.808%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/pytest_mock_resources/fixture/postgresql.py 27 28 96.43%
Totals Coverage Status
Change from base Build 10907347726: 0.2%
Covered Lines: 1506
Relevant Lines: 1657

💛 - Coveralls

@DanCardin DanCardin marked this pull request as ready for review September 18, 2024 16:37
Note, this could **potentially** reveal preexisting issues in code
under test, that could be perceived as a "breaking" change.

By deleting the database under test at the end of the test's execution,
any database connections left connected to the database might cause the
`DELETE DATABASE` command to fail.

PMR will **try** to use the `WITH FORCE` option on database versions >=
13.0, but that option does not exist on prior versions of postgres.

In any case, if this happens, it **is** ultimately revealing a "bug"
in the code it is testing. Additionally, you can simply turn off
database cleanup in one of various ways.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants