You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"First of all, so sorry for my poor english. I will be so happy, if someone pushes a PR correcting all my english mistakes. Anyway I will try to do my best."
# if something fails, everyting is rolleback, you know all or nothing
70
69
```
71
70
72
-
And there's also an `initialization` callable on the main factory function.
73
-
That can be used like in flask to initialize whatever you need on the db.
74
-
The `initialization` is called right after asyncpg stablishes a connection,
71
+
There's also an `initialization` callable on the main factory function.
72
+
This can be used as in flask to do whatever initializion you need.
73
+
`initialization` is called right after asyncpg stablishes a connection,
75
74
and before the app fully boots. (Some projects use this as a poor migration
76
-
runner, not the best practice if you are deploying multiple
75
+
runner, but this is not the best practice if you are deploying multiple
77
76
instances of the app).
78
77
79
78
## Testing
80
79
81
-
For testing we use [pytest-docker-fixtures](https://pypi.org/project/pytest-docker-fixtures/), it requires docker on the host machine or on whatever CI you use
82
-
(seems like works as expected with github actions)
80
+
For testing we use [pytest-docker-fixtures](https://pypi.org/project/pytest-docker-fixtures/),
81
+
it requires docker on the host machine or on whatever CI you use
82
+
(it works as expected with github actions)
83
83
84
-
It works, creating a container for the session and exposing it as pytest fixture.
84
+
It creates a container for the session and exposes it as pytest fixture.
85
85
It's a good practice to run tests with a real database, and
86
-
pytest-docker-fixtures make it's so easy. As a bonus, all fixtures run on a CI.
87
-
We use Jenkins witht docker and docker, but also seems like travis and github actions
88
-
also work.
86
+
pytest-docker-fixtures makes it so easy. As a bonus, all fixtures run in CI.
87
+
We use Jenkins with docker, and docker, but it seems that travis and github
88
+
actions also work.
89
89
90
90
The fixture needs to be added to the pytest plugins `conftest.py` file.
91
91
92
-
on conftest.py
92
+
in conftest.py
93
93
94
94
```python
95
95
pytest_plugins = [
96
96
"pytest_docker_fixtures",
97
97
]
98
98
```
99
99
100
-
With this in place, we can just yield a pg fixture
0 commit comments