pytest-docker 3.1.0__tar.gz → 3.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. {pytest-docker-3.1.0/src/pytest_docker.egg-info → pytest_docker-3.1.2}/PKG-INFO +42 -6
  2. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/README.md +38 -4
  3. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/setup.cfg +4 -2
  4. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker/plugin.py +3 -3
  5. {pytest-docker-3.1.0 → pytest_docker-3.1.2/src/pytest_docker.egg-info}/PKG-INFO +42 -6
  6. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/LICENSE.txt +0 -0
  7. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/pyproject.toml +0 -0
  8. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/setup.py +0 -0
  9. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker/__init__.py +0 -0
  10. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker/py.typed +0 -0
  11. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker.egg-info/SOURCES.txt +0 -0
  12. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker.egg-info/dependency_links.txt +0 -0
  13. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker.egg-info/entry_points.txt +0 -0
  14. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker.egg-info/requires.txt +0 -0
  15. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/src/pytest_docker.egg-info/top_level.txt +0 -0
  16. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/tests/test_docker_ip.py +0 -0
  17. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/tests/test_docker_services.py +0 -0
  18. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/tests/test_dockercomposeexecutor.py +0 -0
  19. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/tests/test_fixtures.py +0 -0
  20. {pytest-docker-3.1.0 → pytest_docker-3.1.2}/tests/test_integration.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pytest-docker
3
- Version: 3.1.0
3
+ Version: 3.1.2
4
4
  Summary: Simple pytest fixtures for Docker and Docker Compose based tests
5
5
  Home-page: https://github.com/avast/pytest-docker
6
6
  Author: Max K., Andre Caron
@@ -12,6 +12,8 @@ Classifier: Programming Language :: Python :: 3.8
12
12
  Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
15
17
  Classifier: License :: OSI Approved :: MIT License
16
18
  Classifier: Topic :: Utilities
17
19
  Classifier: Intended Audience :: Developers
@@ -46,7 +48,7 @@ Docker-based integration tests
46
48
 
47
49
  Simple [pytest](http://doc.pytest.org/) fixtures that help you write integration
48
50
  tests with Docker and [Docker Compose](https://docs.docker.com/compose/).
49
- Specify all necessary containers in a `docker-compose.yml` file and and
51
+ Specify all necessary containers in a `docker-compose.yml` file and
50
52
  `pytest-docker` will spin them up for the duration of your tests.
51
53
 
52
54
  `pytest-docker` was originally created by André Caron.
@@ -78,7 +80,7 @@ Another option could be usage of [`compose-switch`](https://github.com/docker/co
78
80
 
79
81
  # Usage
80
82
 
81
- Here is an example of a test that depends on a HTTP service.
83
+ Here is an example of a test that depends on an HTTP service.
82
84
 
83
85
  With a `docker-compose.yml` file like this (using the
84
86
  [httpbin](https://httpbin.org/) service):
@@ -130,7 +132,7 @@ def test_status_code(http_service):
130
132
  assert response.status_code == status
131
133
  ```
132
134
 
133
- By default this plugin will try to open `docker-compose.yml` in your
135
+ By default, this plugin will try to open `docker-compose.yml` in your
134
136
  `tests` directory. If you need to use a custom location, override the
135
137
  `docker_compose_file` fixture inside your `conftest.py` file:
136
138
 
@@ -144,9 +146,43 @@ def docker_compose_file(pytestconfig):
144
146
  return os.path.join(str(pytestconfig.rootdir), "mycustomdir", "docker-compose.yml")
145
147
  ```
146
148
 
149
+ To use [multiple compose files](https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/),
150
+ return a list of paths from the `docker_compose_file` fixture:
151
+
152
+ ```python
153
+ import os
154
+ import pytest
155
+
156
+
157
+ @pytest.fixture(scope="session")
158
+ def docker_compose_file(pytestconfig):
159
+ return [
160
+ os.path.join(str(pytestconfig.rootdir), "tests", "compose.yml"),
161
+ os.path.join(str(pytestconfig.rootdir), "tests", "compose.override.yml"),
162
+ ]
163
+ ```
164
+
165
+ If you want to debug the test suite in your IDE (Pycharm, VsCode, etc.) and need to stop the test, the stack will be left running.
166
+ To avoid creating multiple stacks, you can pin the project name and always teardown before starting a new stack:
167
+
168
+ ```python
169
+ import pytest
170
+
171
+ # Pin the project name to avoid creating multiple stacks
172
+ @pytest.fixture(scope="session")
173
+ def docker_compose_project_name() -> str:
174
+ return "my-compose-project"
175
+
176
+ # Stop the stack before starting a new one
177
+ @pytest.fixture(scope="session")
178
+ def docker_setup_command():
179
+ return ["down -v", "up --build -d"]
180
+ ```
181
+
182
+
147
183
  ## Available fixtures
148
184
 
149
- By default the scope of the fixtures are `session` but can be changed with
185
+ By default, the scope of the fixtures are `session` but can be changed with
150
186
  `pytest` command line option `--container-scope <scope>`:
151
187
 
152
188
  ```bash
@@ -10,7 +10,7 @@ Docker-based integration tests
10
10
 
11
11
  Simple [pytest](http://doc.pytest.org/) fixtures that help you write integration
12
12
  tests with Docker and [Docker Compose](https://docs.docker.com/compose/).
13
- Specify all necessary containers in a `docker-compose.yml` file and and
13
+ Specify all necessary containers in a `docker-compose.yml` file and
14
14
  `pytest-docker` will spin them up for the duration of your tests.
15
15
 
16
16
  `pytest-docker` was originally created by André Caron.
@@ -42,7 +42,7 @@ Another option could be usage of [`compose-switch`](https://github.com/docker/co
42
42
 
43
43
  # Usage
44
44
 
45
- Here is an example of a test that depends on a HTTP service.
45
+ Here is an example of a test that depends on an HTTP service.
46
46
 
47
47
  With a `docker-compose.yml` file like this (using the
48
48
  [httpbin](https://httpbin.org/) service):
@@ -94,7 +94,7 @@ def test_status_code(http_service):
94
94
  assert response.status_code == status
95
95
  ```
96
96
 
97
- By default this plugin will try to open `docker-compose.yml` in your
97
+ By default, this plugin will try to open `docker-compose.yml` in your
98
98
  `tests` directory. If you need to use a custom location, override the
99
99
  `docker_compose_file` fixture inside your `conftest.py` file:
100
100
 
@@ -108,9 +108,43 @@ def docker_compose_file(pytestconfig):
108
108
  return os.path.join(str(pytestconfig.rootdir), "mycustomdir", "docker-compose.yml")
109
109
  ```
110
110
 
111
+ To use [multiple compose files](https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/),
112
+ return a list of paths from the `docker_compose_file` fixture:
113
+
114
+ ```python
115
+ import os
116
+ import pytest
117
+
118
+
119
+ @pytest.fixture(scope="session")
120
+ def docker_compose_file(pytestconfig):
121
+ return [
122
+ os.path.join(str(pytestconfig.rootdir), "tests", "compose.yml"),
123
+ os.path.join(str(pytestconfig.rootdir), "tests", "compose.override.yml"),
124
+ ]
125
+ ```
126
+
127
+ If you want to debug the test suite in your IDE (Pycharm, VsCode, etc.) and need to stop the test, the stack will be left running.
128
+ To avoid creating multiple stacks, you can pin the project name and always teardown before starting a new stack:
129
+
130
+ ```python
131
+ import pytest
132
+
133
+ # Pin the project name to avoid creating multiple stacks
134
+ @pytest.fixture(scope="session")
135
+ def docker_compose_project_name() -> str:
136
+ return "my-compose-project"
137
+
138
+ # Stop the stack before starting a new one
139
+ @pytest.fixture(scope="session")
140
+ def docker_setup_command():
141
+ return ["down -v", "up --build -d"]
142
+ ```
143
+
144
+
111
145
  ## Available fixtures
112
146
 
113
- By default the scope of the fixtures are `session` but can be changed with
147
+ By default, the scope of the fixtures are `session` but can be changed with
114
148
  `pytest` command line option `--container-scope <scope>`:
115
149
 
116
150
  ```bash
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = pytest-docker
3
- version = 3.1.0
3
+ version = 3.1.2
4
4
  description = Simple pytest fixtures for Docker and Docker Compose based tests
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -15,6 +15,8 @@ classifiers =
15
15
  Programming Language :: Python :: 3.9
16
16
  Programming Language :: Python :: 3.10
17
17
  Programming Language :: Python :: 3.11
18
+ Programming Language :: Python :: 3.12
19
+ Programming Language :: Python :: 3.13
18
20
  License :: OSI Approved :: MIT License
19
21
  Topic :: Utilities
20
22
  Intended Audience :: Developers
@@ -23,7 +25,7 @@ classifiers =
23
25
  Operating System :: Microsoft :: Windows
24
26
 
25
27
  [options]
26
- python_requires = >= 3.8
28
+ python_requires = >=3.8
27
29
  package_dir =
28
30
  =src
29
31
  packages = pytest_docker
@@ -150,7 +150,7 @@ def docker_compose_command() -> str:
150
150
 
151
151
 
152
152
  @pytest.fixture(scope=containers_scope)
153
- def docker_compose_file(pytestconfig: Any) -> str:
153
+ def docker_compose_file(pytestconfig: Any) -> Union[List[str], str]:
154
154
  """Get an absolute path to the `docker-compose.yml` file. Override this
155
155
  fixture in your tests if you need a custom location."""
156
156
 
@@ -194,7 +194,7 @@ def docker_setup() -> Union[List[str], str]:
194
194
  @contextlib.contextmanager
195
195
  def get_docker_services(
196
196
  docker_compose_command: str,
197
- docker_compose_file: str,
197
+ docker_compose_file: Union[List[str], str],
198
198
  docker_compose_project_name: str,
199
199
  docker_setup: Union[List[str], str],
200
200
  docker_cleanup: Union[List[str], str],
@@ -227,7 +227,7 @@ def get_docker_services(
227
227
  @pytest.fixture(scope=containers_scope)
228
228
  def docker_services(
229
229
  docker_compose_command: str,
230
- docker_compose_file: str,
230
+ docker_compose_file: Union[List[str], str],
231
231
  docker_compose_project_name: str,
232
232
  docker_setup: str,
233
233
  docker_cleanup: str,
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pytest-docker
3
- Version: 3.1.0
3
+ Version: 3.1.2
4
4
  Summary: Simple pytest fixtures for Docker and Docker Compose based tests
5
5
  Home-page: https://github.com/avast/pytest-docker
6
6
  Author: Max K., Andre Caron
@@ -12,6 +12,8 @@ Classifier: Programming Language :: Python :: 3.8
12
12
  Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
15
17
  Classifier: License :: OSI Approved :: MIT License
16
18
  Classifier: Topic :: Utilities
17
19
  Classifier: Intended Audience :: Developers
@@ -46,7 +48,7 @@ Docker-based integration tests
46
48
 
47
49
  Simple [pytest](http://doc.pytest.org/) fixtures that help you write integration
48
50
  tests with Docker and [Docker Compose](https://docs.docker.com/compose/).
49
- Specify all necessary containers in a `docker-compose.yml` file and and
51
+ Specify all necessary containers in a `docker-compose.yml` file and
50
52
  `pytest-docker` will spin them up for the duration of your tests.
51
53
 
52
54
  `pytest-docker` was originally created by André Caron.
@@ -78,7 +80,7 @@ Another option could be usage of [`compose-switch`](https://github.com/docker/co
78
80
 
79
81
  # Usage
80
82
 
81
- Here is an example of a test that depends on a HTTP service.
83
+ Here is an example of a test that depends on an HTTP service.
82
84
 
83
85
  With a `docker-compose.yml` file like this (using the
84
86
  [httpbin](https://httpbin.org/) service):
@@ -130,7 +132,7 @@ def test_status_code(http_service):
130
132
  assert response.status_code == status
131
133
  ```
132
134
 
133
- By default this plugin will try to open `docker-compose.yml` in your
135
+ By default, this plugin will try to open `docker-compose.yml` in your
134
136
  `tests` directory. If you need to use a custom location, override the
135
137
  `docker_compose_file` fixture inside your `conftest.py` file:
136
138
 
@@ -144,9 +146,43 @@ def docker_compose_file(pytestconfig):
144
146
  return os.path.join(str(pytestconfig.rootdir), "mycustomdir", "docker-compose.yml")
145
147
  ```
146
148
 
149
+ To use [multiple compose files](https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/),
150
+ return a list of paths from the `docker_compose_file` fixture:
151
+
152
+ ```python
153
+ import os
154
+ import pytest
155
+
156
+
157
+ @pytest.fixture(scope="session")
158
+ def docker_compose_file(pytestconfig):
159
+ return [
160
+ os.path.join(str(pytestconfig.rootdir), "tests", "compose.yml"),
161
+ os.path.join(str(pytestconfig.rootdir), "tests", "compose.override.yml"),
162
+ ]
163
+ ```
164
+
165
+ If you want to debug the test suite in your IDE (Pycharm, VsCode, etc.) and need to stop the test, the stack will be left running.
166
+ To avoid creating multiple stacks, you can pin the project name and always teardown before starting a new stack:
167
+
168
+ ```python
169
+ import pytest
170
+
171
+ # Pin the project name to avoid creating multiple stacks
172
+ @pytest.fixture(scope="session")
173
+ def docker_compose_project_name() -> str:
174
+ return "my-compose-project"
175
+
176
+ # Stop the stack before starting a new one
177
+ @pytest.fixture(scope="session")
178
+ def docker_setup_command():
179
+ return ["down -v", "up --build -d"]
180
+ ```
181
+
182
+
147
183
  ## Available fixtures
148
184
 
149
- By default the scope of the fixtures are `session` but can be changed with
185
+ By default, the scope of the fixtures are `session` but can be changed with
150
186
  `pytest` command line option `--container-scope <scope>`:
151
187
 
152
188
  ```bash
File without changes
File without changes