Skip to content

Commit 94c16ac

Browse files
combine tc with tc-core and pass tests
1 parent 7799d86 commit 94c16ac

File tree

8 files changed

+356
-640
lines changed

8 files changed

+356
-640
lines changed

core/README.rst

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

core/poetry.lock

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

core/pyproject.toml

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

core/tests/test_core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66

77
def test_raise_timeout():
8+
import pathlib
9+
pathlib.Path('/tmp/YESS').write_text('abc')
810
with pytest.raises(TimeoutError):
911
with DockerContainer("alpine").with_command("sleep 2") as container:
1012
wait_for_logs(container, "Hello from Docker!", timeout=1e-3)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
import urllib
2+
import urllib.request
33
import pytest
44

55
from testcontainers.elasticsearch import ElasticSearchContainer
@@ -8,6 +8,6 @@
88
# The versions below were the current supported versions at time of writing (2022-08-11)
99
@pytest.mark.parametrize('version', ['6.8.23', '7.17.5', '8.3.3'])
1010
def test_docker_run_elasticsearch(version):
11-
with ElasticSearchContainer(f'elasticsearch:{version}') as es:
11+
with ElasticSearchContainer(f'elasticsearch:{version}', mem_limit='3G') as es:
1212
resp = urllib.request.urlopen(es.get_url())
1313
assert json.loads(resp.read().decode())['version']['number'] == version

modules/opensearch/testcontainers/opensearch/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from opensearchpy import OpenSearch
22
from opensearchpy.exceptions import ConnectionError, TransportError
3+
from urllib3.exceptions import ProtocolError
34

45
from testcontainers.core.container import DockerContainer
56
from testcontainers.core.utils import raise_for_deprecated_parameter
@@ -84,7 +85,12 @@ def get_client(self, verify_certs: bool = False, **kwargs) -> OpenSearch:
8485
**kwargs,
8586
)
8687

87-
@wait_container_is_ready(ConnectionError, TransportError)
88+
@wait_container_is_ready(
89+
ConnectionError,
90+
TransportError,
91+
ProtocolError,
92+
ConnectionResetError
93+
)
8894
def _healthcheck(self) -> None:
8995
"""This is an internal method used to check if the OpenSearch container
9096
is healthy and ready to receive requests."""

poetry.lock

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

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ classifiers = [
2727
]
2828
# testcontainers-core is a proper package dependency - only modules needed here
2929
packages = [
30+
{ include = "testcontainers", from = "core" },
3031
{ include = "testcontainers", from = "modules/arangodb" },
3132
{ include = "testcontainers", from = "modules/azurite" },
3233
{ include = "testcontainers", from = "modules/clickhouse" },
@@ -56,7 +57,9 @@ packages = [
5657

5758
[tool.poetry.dependencies]
5859
python = ">=3.9,<3.12"
59-
testcontainers-core = "4.0.0" # x-release-please-version
60+
docker = "*" # ">=4.0"
61+
urllib3 = "*" # "<2.0"
62+
wrapt = "*" # "^1.16.0"
6063

6164
# community modules
6265
python-arango = { version = "^7.8", optional = true }
@@ -103,11 +106,11 @@ redis = ["redis"]
103106
selenium = ["selenium"]
104107

105108
[tool.poetry.group.dev.dependencies]
106-
testcontainers-core = { path = "core", develop = true }
107109
pytest = "7.4.3"
108110
pytest-cov = "4.1.0"
109111
sphinx = "^7.2.6"
110112
flake8 = "^6.1.0"
113+
pg8000 = "*"
111114

112115
[[tool.poetry.source]]
113116
name = "PyPI"

0 commit comments

Comments
 (0)