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

Question: How to run tests outside of a docker container? #24

Closed
omrihar opened this issue May 6, 2019 · 3 comments
Closed

Question: How to run tests outside of a docker container? #24

omrihar opened this issue May 6, 2019 · 3 comments

Comments

@omrihar
Copy link

omrihar commented May 6, 2019

Hi, thanks for the beautiful framework and cookiecutter project!

I'm setting up a project using this cookiecutter and I haven't managed to run the tests without the use of the script that generates the tests docker container. Is there a way to quickly run the tests without recreating a docker container?
I plan to use TDD in my development and if I have to wait a long time for the tests to run it will discourage me from following that practice...

I tried running the tests by executing docker-compose exec backend bash and then running the tests running bash tests-start.sh and also by simply running pytest, but for the former the tests don't manage to authenticate and for the latte I get a pytest not found error.

Any hints would be very welcome!

@ebreton
Copy link
Contributor

ebreton commented May 6, 2019

Hi @omrihar

You can check #12 where I explain how to do exactly what you are looking for, and also another way (more elegant) to do it as suggested by @tiangolo

To even make his proposition better, there is #17 which has been merged in

@omrihar
Copy link
Author

omrihar commented May 7, 2019

Hi @ebreton
Thanks for your reply! I also got an answer from @tiangolo on gitter for this. The tests (of the cookiecutter project) still take about 6-8 seconds to run, which is not negligible, but seems much better than what I thought at first (which was that you should use the script that creates the docker images from scratch). I also managed to install pytest-watch inside the container and use ptw to continuously run the tests whenever the code changes :)

btw, I really like your suggestion for the CrudBase in the (still open) PR.

Cheers,
Omri

@omrihar omrihar closed this as completed May 7, 2019
@tiangolo
Copy link
Owner

Thanks for your help @ebreton !

I'm glad you solved it @omrihar .

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

3 participants