-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add pytest-based testing framework #143
Conversation
afa2cee
to
e4876b1
Compare
The PostgreSQL license is very liberal but, like MIT and BSD, it does require attribution and requires that the original license is included. This adds a NOTICE file containing the license, because we've vendored in a few files/functions from the Postgres repository and we'll likely need to vendor in more. If/when we decide to to merge #143 we should also include PgBouncer its license. Which is the ISC license, which is also attribution-only.
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.
I don't mind adding this for testing purposes - so approving. Only thing that i would like to understand why we need ruff
.
Ruff is for auto formatting |
The PostgreSQL license is very liberal but, like MIT and BSD, it does require attribution and requires that the original license is included. This adds a NOTICE file containing the license, because we've vendored in a few files/functions from the Postgres repository and we'll likely need to vendor in more. If/when we decide to to merge #143 we should also include PgBouncer its license. Which is the ISC license, which is also attribution-only.
`pgregress` is easy to use an is part of Postgres, so it's often the first thing to use testing a Postgres extension. But it also quite limiting, since you can only execute SQL and a test fails as soon as any of the output is different. This adds a Python based testing framework to the project, which allows to do more "application" style testing. It's based on the testing framework I wrote for PgBouncer, but I removed a bunch of stuff that only made sense when testing PgBouncer. Postgres has a similar framework included, but that uses Perl and I really don't want to write any Perl. Also `pytest` is a much nicer to use testing framework than what is available in Perl. As an example of a test that cannot easily be written using `pgregress` I added a test for `EXPLAIN ANALYZE`. Support for `EXPLAIN ANALYZE` was added in #136, but writing a test was not possible because the Timing information would be flaky.
I love this, |
This could also be used to make #88 testable, verifying that files are correctly downloaded, multiple processes can make use of it and not break etc.. |
pgregress
is easy to use an is part of Postgres, so it's often the first thing to use testing a Postgres extension. But it also quite limiting, since you can only execute SQL and a test fails as soon as any of the output is different.This adds a Python based testing framework to the project, which allows to do more "application" style testing. It's based on the testing framework I wrote for PgBouncer, but I removed a bunch of stuff that only made sense when testing PgBouncer. Postgres has a similar framework included, but that uses Perl and I really don't want to write any Perl. Also
pytest
is a much nicer to use testing framework than what is available in Perl.As an example of a test that cannot easily be written using
pgregress
I added a test forEXPLAIN ANALYZE
. Support forEXPLAIN ANALYZE
was added in #136, but writing a test was not possible because the Timing information would be flaky.