diff --git a/modules/test_module_import/README.rst b/modules/test_module_import/README.rst new file mode 100644 index 00000000..3d2e7543 --- /dev/null +++ b/modules/test_module_import/README.rst @@ -0,0 +1,2 @@ +.. autoclass:: testcontainers.test_module_import.NewSubModuleContainer +.. title:: testcontainers.test_module_import.NewSubModuleContainer diff --git a/modules/testmoduleimport/testcontainers/testmoduleimport/__init__.py b/modules/test_module_import/testcontainers/test_module_import/__init__.py similarity index 100% rename from modules/testmoduleimport/testcontainers/testmoduleimport/__init__.py rename to modules/test_module_import/testcontainers/test_module_import/__init__.py diff --git a/modules/testmoduleimport/testcontainers/testmoduleimport/new_sub_module.py b/modules/test_module_import/testcontainers/test_module_import/new_sub_module.py similarity index 68% rename from modules/testmoduleimport/testcontainers/testmoduleimport/new_sub_module.py rename to modules/test_module_import/testcontainers/test_module_import/new_sub_module.py index f45796f7..6f25d277 100644 --- a/modules/testmoduleimport/testcontainers/testmoduleimport/new_sub_module.py +++ b/modules/test_module_import/testcontainers/test_module_import/new_sub_module.py @@ -9,19 +9,19 @@ class NewSubModuleContainer(ServerContainer): >>> import httpx >>> from testcontainers.core.image import DockerImage - >>> from testcontainers.testmoduleimport import NewSubModuleContainer + >>> from testcontainers.test_module_import import NewSubModuleContainer - >>> with DockerImage(path="./modules/generic/tests/samples/python_server", tag="test-mod:latest") as image: - ... with NewSubModuleContainer(port=9000, image=image) as srv: - ... url = srv._create_connection_url() + >>> with DockerImage(path="./modules/generic/tests/samples/python_server", tag="test-new-mod:latest") as image: + ... with NewSubModuleContainer(port=9000, image=image) as new_mod: + ... url = new_mod._create_connection_url() ... response = httpx.get(f"{url}", timeout=5) ... assert response.status_code == 200, "Response status code is not 200" - ... assert srv.print_mock() == "NewSubModuleContainer" + ... assert new_mod.additional_capability() == "NewSubModuleContainer" """ def __init__(self, port: int, image: str) -> None: super().__init__(port, image) - def print_mock(self) -> str: + def additional_capability(self) -> str: return "NewSubModuleContainer" diff --git a/modules/testmoduleimport/tests/test_mock_one.py b/modules/test_module_import/tests/test_mock_one.py similarity index 50% rename from modules/testmoduleimport/tests/test_mock_one.py rename to modules/test_module_import/tests/test_mock_one.py index 85ac6c31..915c95b1 100644 --- a/modules/testmoduleimport/tests/test_mock_one.py +++ b/modules/test_module_import/tests/test_mock_one.py @@ -2,14 +2,13 @@ from testcontainers.core.waiting_utils import wait_for_logs from testcontainers.core.image import DockerImage -from testcontainers.testmoduleimport import NewSubModuleContainer +from testcontainers.test_module_import import NewSubModuleContainer def test_like_doctest(): - with DockerImage(path="./modules/generic/tests/samples/python_server", tag="test-srv:latest") as image: - with NewSubModuleContainer(port=9000, image=image) as srv: - assert srv.print_mock() == "NewSubModuleContainer" - url = srv._create_connection_url() + with DockerImage(path="./modules/generic/tests/samples/python_server", tag="test-new-mod:latest") as image: + with NewSubModuleContainer(port=9000, image=image) as new_mod: + url = new_mod._create_connection_url() response = httpx.get(f"{url}", timeout=5) assert response.status_code == 200, "Response status code is not 200" - _ = wait_for_logs(srv, "GET / HTTP/1.1") + assert new_mod.additional_capability() == "NewSubModuleContainer" diff --git a/modules/testmoduleimport/README.rst b/modules/testmoduleimport/README.rst deleted file mode 100644 index ae5d5708..00000000 --- a/modules/testmoduleimport/README.rst +++ /dev/null @@ -1,2 +0,0 @@ -.. autoclass:: testcontainers.testmoduleimport.NewSubModuleContainer -.. title:: testcontainers.testmoduleimport.NewSubModuleContainer diff --git a/poetry.lock b/poetry.lock index c7d5dc5e..548521e5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1913,7 +1913,6 @@ python-versions = ">=3.7" files = [ {file = "milvus_lite-2.4.7-py3-none-macosx_10_9_x86_64.whl", hash = "sha256:c828190118b104b05b8c8e0b5a4147811c86b54b8fb67bc2e726ad10fc0b544e"}, {file = "milvus_lite-2.4.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e1537633c39879714fb15082be56a4b97f74c905a6e98e302ec01320561081af"}, - {file = "milvus_lite-2.4.7-py3-none-manylinux2014_aarch64.whl", hash = "sha256:fcb909d38c83f21478ca9cb500c84264f988c69f62715ae9462e966767fb76dd"}, {file = "milvus_lite-2.4.7-py3-none-manylinux2014_x86_64.whl", hash = "sha256:f016474d663045787dddf1c3aad13b7d8b61fd329220318f858184918143dcbf"}, ] @@ -4508,11 +4507,11 @@ rabbitmq = ["pika"] redis = ["redis"] registry = ["bcrypt"] selenium = ["selenium"] -testmoduleimport = ["httpx"] +test-module-import = ["httpx"] vault = [] weaviate = ["weaviate-client"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "bda3a38eb7c78fae7290b2dfb1535e676ba3fc3189d2baeda9454caa96e572f5" +content-hash = "e95316f2de630e690a4e62f240dad0461e9adb936474c9d7cb4a556ec54cb70b" diff --git a/pyproject.toml b/pyproject.toml index 54516f43..616c4206 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ packages = [ { include = "testcontainers", from = "modules/cosmosdb" }, { include = "testcontainers", from = "modules/elasticsearch" }, { include = "testcontainers", from = "modules/generic" }, - { include = "testcontainers", from = "modules/testmoduleimport"}, + { include = "testcontainers", from = "modules/test_module_import"}, { include = "testcontainers", from = "modules/google" }, { include = "testcontainers", from = "modules/influxdb" }, { include = "testcontainers", from = "modules/k3s" }, @@ -120,7 +120,7 @@ cosmosdb = ["azure-cosmos"] cockroachdb = [] elasticsearch = [] generic = ["httpx"] -testmoduleimport = ["httpx"] +test_module_import = ["httpx"] google = ["google-cloud-pubsub", "google-cloud-datastore"] influxdb = ["influxdb", "influxdb-client"] k3s = ["kubernetes", "pyyaml"]