|
14 | 14 | :codebase: https://raw.githubusercontent.com/testcontainers/tc-guide-getting-started-with-testcontainers-for-python/main
|
15 | 15 |
|
16 | 16 | Testcontainers is an open-source framework for provisioning throwaway, on-demand containers for development and testing use cases.
|
17 |
| -Testcontainers makes it easy to work with databases, message brokers, web browsers, or just about anything |
| 17 | +Testcontainers make it easy to work with databases, message brokers, web browsers, or just about anything |
18 | 18 | that can run in a Docker container.
|
19 | 19 |
|
20 | 20 | Using Testcontainers, you can write tests talking to the same type of services you use in production
|
@@ -58,7 +58,7 @@ Once the dependencies are installed, we have used *pip freeze* command to genera
|
58 | 58 | so that others can install the same versions of packages simply using *pip install -r requirements.txt*.
|
59 | 59 |
|
60 | 60 | == Implement Database Helper
|
61 |
| -Let's create *db/connection.py* file and create a function to get database connection as follows: |
| 61 | +Let's create *db/connection.py* file and create a function to get a database connection as follows: |
62 | 62 |
|
63 | 63 | [source,python]
|
64 | 64 | ----
|
@@ -118,7 +118,7 @@ def setup():
|
118 | 118 | # teardown code
|
119 | 119 | ----
|
120 | 120 |
|
121 |
| -However, with this approach, if there is an exception occurred in the setup code, the teardown code will not be executed. So, a better approach is to use https://pytest.org/en/7.4.x/how-to/fixtures.html#adding-finalizers-directly[finalizers] as follows: |
| 121 | +However, with this approach, if there is an exception occurs in the setup code, the teardown code will not be executed. So, a better approach is to use https://pytest.org/en/7.4.x/how-to/fixtures.html#adding-finalizers-directly[finalizers] as follows: |
122 | 122 |
|
123 | 123 | [source,python]
|
124 | 124 | ----
|
@@ -156,7 +156,7 @@ include::{codebase}/tests/test_customers.py[lines="32..44"]
|
156 | 156 | * In the *test_get_all_customers()* test, we are inserting two customer records into the database,
|
157 | 157 | fetching all the existing customers, and asserting the number of customers.
|
158 | 158 | * In the *test_get_customer_by_email()* test, we are inserting a customer record into the database,
|
159 |
| - fetching the customer by email, and asserting the customer details. |
| 159 | + fetch the customer by email, and asserting the customer details. |
160 | 160 |
|
161 | 161 | As we are deleting all the customer records before every test, the tests can be run in any order.
|
162 | 162 |
|
|
0 commit comments