Skip to content

feat: Add cleanup_database option to postgres fixture.#219

Open
DanCardin wants to merge 1 commit into
mainfrom
dc/cleanup_database
Open

feat: Add cleanup_database option to postgres fixture.#219
DanCardin wants to merge 1 commit into
mainfrom
dc/cleanup_database

Conversation

@DanCardin

Copy link
Copy Markdown
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

coveralls commented Sep 18, 2024

Copy link
Copy Markdown

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.
@DanCardin DanCardin force-pushed the dc/cleanup_database branch from 609e488 to 574d084 Compare October 1, 2024 20:20
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