Skip to content

Commit 809be67

Browse files
feat(build): organise use poetry and organise modules
1 parent 6ee98a3 commit 809be67

File tree

103 files changed

+3246
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3246
-565
lines changed

.coveragerc

Lines changed: 0 additions & 12 deletions
This file was deleted.

CODEOWNERS

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
/arangodb @nshine
2-
/azurite @pffijt
3-
/clickhouse @yakimka
1+
/modules/arangodb @nshine
2+
/modules/azurite @pffijt
3+
/modules/clickhouse @yakimka
44
# /compose
55
# /core
6-
/elasticsearch @nivm @daTokenizer
7-
/google @tillahoffmann
8-
/kafka @ash1425
9-
/keycloak @timbmg
10-
/localstack @ImFlog
11-
# /meta
12-
/minio @maltehedderich
13-
/mongodb @dabrign
14-
# /mssql
15-
# /mysql
16-
/neo4j @eastlondoner
17-
# /nginx
18-
/opensearch @maltehedderich
19-
# /oracle
20-
# /postgres
21-
/rabbitmq @KerstenBreuer
22-
/redis @daTokenizer
23-
# /selenium
6+
/modules/elasticsearch @nivm @daTokenizer
7+
/modules/google @tillahoffmann
8+
/modules/kafka @ash1425
9+
/modules/keycloak @timbmg
10+
/modules/localstack @ImFlog
11+
/modules/minio @maltehedderich
12+
/modules/mongodb @dabrign
13+
# /modules/mssql
14+
# /modules/mysql
15+
/modules/neo4j @eastlondoner
16+
# /modules/nginx
17+
/modules/opensearch @maltehedderich
18+
# /modules/oracle
19+
# /modules/postgres
20+
/modules/rabbitmq @KerstenBreuer
21+
/modules/redis @daTokenizer
22+
# /modules/selenium

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
PYTHON_VERSIONS = 3.7 3.8 3.9 3.10 3.11
1+
PYTHON_VERSIONS = 3.9 3.10 3.11
22
PYTHON_VERSION ?= 3.10
33
IMAGE = testcontainers-python:${PYTHON_VERSION}
44
RUN = docker run --rm -it
55
# Get all directories that contain a setup.py and get the directory name.
6-
PACKAGES = $(subst /,,$(dir $(wildcard */setup.py)))
6+
PACKAGES = core $(dir $(wildcard modules/*/README.rst))
77

88
# All */dist folders for each of the packages.
99
DISTRIBUTIONS = $(addsuffix /dist,${PACKAGES})
@@ -25,12 +25,12 @@ ${DISTRIBUTIONS} : %/dist : %/setup.py
2525
# Targets to run the test suite for each package.
2626
tests : ${TESTS}
2727
${TESTS} : %/tests :
28-
pytest -svx --cov-report=term-missing --cov=testcontainers.$* --tb=short --strict-markers $*/tests
28+
poetry run pytest -v --cov=testcontainers.$* $*/tests
2929

3030
# Targets to lint the code.
3131
lint : ${LINT}
3232
${LINT} : %/lint :
33-
flake8 $*
33+
poetry run flake8 $*
3434

3535
# Targets to publish packages.
3636
upload : ${UPLOAD}
@@ -54,13 +54,13 @@ ${TESTS_DIND} : %/tests-dind : image
5454

5555
# Target to build the documentation
5656
docs :
57-
sphinx-build -nW . docs/_build
57+
poetry run sphinx-build -nW . docs/_build
5858

5959
doctest : ${DOCTESTS}
60-
sphinx-build -b doctest . docs/_build
60+
poetry run sphinx-build -b doctest . docs/_build
6161

6262
${DOCTESTS} : %/doctest :
63-
sphinx-build -b doctest -c doctests $* docs/_build
63+
poetry run sphinx-build -b doctest -c doctests $* docs/_build
6464

6565
# Remove any generated files.
6666
clean :

arangodb/setup.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

azurite/setup.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

clickhouse/setup.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

core/poetry.lock

Lines changed: 298 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[tool.poetry]
2+
name = "testcontainers-core"
3+
version = "4.0.0" # x-release-please-version
4+
description = "Essential components of testcontainers-python."
5+
authors = ["Sergey Pirogov <[email protected]>"]
6+
maintainers = [
7+
"Balint Bartha <[email protected]>",
8+
"David Ankin <[email protected]>"
9+
]
10+
readme = "README.rst"
11+
keywords = ["testing", "logging", "docker", "test automation"]
12+
classifiers = [
13+
"License :: OSI Approved :: Apache Software License",
14+
"Intended Audience :: Information Technology",
15+
"Intended Audience :: Developers",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.7",
18+
"Programming Language :: Python :: 3.8",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Topic :: Software Development :: Libraries :: Python Modules",
23+
"Operating System :: Microsoft :: Windows",
24+
"Operating System :: POSIX",
25+
"Operating System :: Unix",
26+
"Operating System :: MacOS",
27+
]
28+
packages = [{ include = "testcontainers" }]
29+
30+
[tool.poetry.dependencies]
31+
python = ">=3.9,<3.12"
32+
docker = ">=4.0"
33+
urllib3 = "<2.0"
34+
wrapt = "^1.16.0"

core/setup.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

core/testcontainers/core/container.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from docker.models.containers import Container
21
import os
32
from typing import Iterable, Optional, Tuple
43

5-
from .waiting_utils import wait_container_is_ready
6-
from .docker_client import DockerClient
7-
from .exceptions import ContainerStartException
8-
from .utils import setup_logger, inside_container, is_arm
4+
from docker.models.containers import Container
5+
6+
from testcontainers.core.docker_client import DockerClient
7+
from testcontainers.core.exceptions import ContainerStartException
8+
from testcontainers.core.utils import setup_logger, inside_container, is_arm
9+
from testcontainers.core.waiting_utils import wait_container_is_ready
910

1011
logger = setup_logger(__name__)
1112

core/testcontainers/core/docker_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
# License for the specific language governing permissions and limitations
1212
# under the License.
1313
import atexit
14-
import docker
15-
from docker.errors import NotFound
16-
from docker.models.containers import Container, ContainerCollection
1714
import functools as ft
1815
import os
19-
from typing import List, Optional, Union
2016
import urllib
17+
from typing import List, Optional, Union
2118

22-
from .utils import default_gateway_ip, inside_container, setup_logger
19+
import docker
20+
from docker.errors import NotFound
21+
from docker.models.containers import Container, ContainerCollection
2322

23+
from .utils import default_gateway_ip, inside_container, setup_logger
2424

2525
LOGGER = setup_logger(__name__)
2626

core/testcontainers/core/generic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
# under the License.
1313
from typing import Optional
1414

15-
from .container import DockerContainer
16-
from .exceptions import ContainerStartException
17-
from .utils import raise_for_deprecated_parameter
18-
from .waiting_utils import wait_container_is_ready
15+
from testcontainers.core.container import DockerContainer
16+
from testcontainers.core.exceptions import ContainerStartException
17+
from testcontainers.core.utils import raise_for_deprecated_parameter
18+
from testcontainers.core.waiting_utils import wait_container_is_ready
1919

2020
ADDITIONAL_TRANSIENT_ERRORS = []
2121
try:

core/testcontainers/core/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import logging
12
import os
23
import platform
3-
import sys
44
import subprocess
5-
import logging
5+
import sys
66

77
LINUX = "linux"
88
MAC = "mac"

core/testcontainers/core/waiting_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
import time
1717
import traceback
1818
from typing import Any, Callable, Iterable, Mapping, Optional, TYPE_CHECKING, Union
19+
1920
import wrapt
2021

21-
from . import config
22-
from .utils import setup_logger
22+
from testcontainers.core import config
23+
from testcontainers.core.utils import setup_logger
2324

2425
if TYPE_CHECKING:
25-
from .container import DockerContainer
26+
from testcontainers.core.container import DockerContainer
2627

2728
logger = setup_logger(__name__)
2829

29-
3030
# Get a tuple of transient exceptions for which we'll retry. Other exceptions will be raised.
3131
TRANSIENT_EXCEPTIONS = (TimeoutError, ConnectionError)
3232

@@ -46,7 +46,7 @@ def wait_container_is_ready(*transient_exceptions) -> Callable:
4646

4747
@wrapt.decorator
4848
def wrapper(wrapped: Callable, instance: Any, args: Iterable, kwargs: Mapping) -> Any:
49-
from .container import DockerContainer
49+
from testcontainers.core.container import DockerContainer
5050

5151
if isinstance(instance, DockerContainer):
5252
logger.info("Waiting for container %s with image %s to be ready ...",

core/tests/test_docker_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from unittest.mock import MagicMock, patch
22
import docker
3+
34
from testcontainers.core.docker_client import DockerClient
45
from testcontainers.core.container import DockerContainer
56

elasticsearch/setup.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

google/setup.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

k3s/setup.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

kafka/setup.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)