Suppose you have an application where you need to run your unit tests. The directory structure looks something like this but honestly it doesn't matter as long as it is somewhere inside your code folder.
Once you have written you unit tests(In this w have written integration and system tests) as well the only thing remains is to test them from inside the container
Here we have a docker-compose file for building up the images and here we have two containers one for the database and other a flask rest api for crud operations using the database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Our testing however note uses sqllite which is an in-memory db.
The way to run your tests from inside the docker container is actually quite simple and is just addition of one line
RUN python -m unittest discover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Welcome to part 1 of writing python like a pro. This series is definitely part of the advanced python series. It assumes you already know python and are definitely comfortable with it. However, you are Read more…
In this series, we would focus on some of the language-agnostic parts which can be used to improve your ability to write cleaner code in any language. So let’s dive right into the SOLID concepts Read more…
Writing clean code is more of an art rather than a science. So What really makes code cleaner?. In this series called Clean Code Concepts, we investigate some of the ways to write code in Read more…
0 Comments