FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: update test module import by Tranquility2 · Pull Request #623 · testcontainers/testcontainers-python · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .lock  (1) .py  (3) .rst  (2) .toml  (1) All 4 file types selected
Only manifest files
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 2 additions & 0 deletions modules/test_module_import/README.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. autoclass:: testcontainers.test_module_import.NewSubModuleContainer
.. title:: testcontainers.test_module_import.NewSubModuleContainer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 0 additions & 2 deletions modules/testmoduleimport/README.rst

This file was deleted.

5 changes: 2 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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"]
Expand Down

Back | FazBrowse Home | New Git URL