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

Test Case(s) #22

Open
Carelvd opened this issue Sep 22, 2019 · 2 comments
Open

Test Case(s) #22

Carelvd opened this issue Sep 22, 2019 · 2 comments

Comments

@Carelvd
Copy link

Carelvd commented Sep 22, 2019

Dear Ms. Cochrane,

I see in some of the other issues that you typically ask for the users to run their tests against PostgreSQL. I though it might be prudent for the project to provide a branch of PyTest-Flask-SQLAlchemy that provided a standard test that users could run against their own database. One could point users with issues to the test and ask them to run it first when reporting an issue. I have provided the code for such a test in my fork on a branch called testing.

Github, to my knowledge, does not allow one to create a PR pushing a branch from one repository to another, so you would have to pull this across if you wanted it for the project.

To make testing PyTest-Flask-SQLAlchemy as convenient as possible I have added a command line interface to the testing suite that creates a database and populates the schema prior to one running the tests and then removes it afterwards. The tests themselves take an additional argument that specifies the database so that this is not hard coded. So a typical use case would be as follows :

python -m flask_test create DATABASE+PROTOCOL://HOSTNAME:HOSTPORT DATASTORE
python -m flask_test schema DATABASE+PROTOCOL://HOSTNAME:HOSTPORT/DATASTORE
pytest --database DATABASE+PROTOCOL://HOSTNAME:HOSTPORT/DATASTORE
python -m flask_test create DATABASE+PROTOCOL://HOSTNAME:HOSTPORT/DATASTORE

Regards,

Carel van Dam

@jeancochrane
Copy link
Owner

This is a pretty interesting idea, thanks for opening an issue and providing some of your work. Definitely my least favorite part about the design of the package is how much boilerplate is required to setup the required fixtures, and if we could move more of that to command line flags or pytest config values then it'd make the package a lot more useable. Still, I don't have a good handle on what the implications would be of switching to this approach, particularly in terms of the tradeoff inherent in abstracting away database setup and the feasibility of supporting multiple database engines. I'll have to spend some time digging in before I can say definitively if this is an area I'm interested in.

@Carelvd
Copy link
Author

Carelvd commented Oct 1, 2019 via email

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

No branches or pull requests

2 participants