{"id":19336538,"url":"https://github.com/spt-development/testcontainers-python-poc","last_synced_at":"2025-08-16T17:04:10.796Z","repository":{"id":50173935,"uuid":"250547065","full_name":"spt-development/testcontainers-python-poc","owner":"spt-development","description":"The aim of this project is to POC the use of testcontainers-python for integration testing python code.","archived":false,"fork":false,"pushed_at":"2022-12-08T03:54:24.000Z","size":10,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-16T17:02:21.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spt-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-27T13:52:03.000Z","updated_at":"2020-03-27T15:35:20.000Z","dependencies_parsed_at":"2023-01-24T09:15:31.765Z","dependency_job_id":null,"html_url":"https://github.com/spt-development/testcontainers-python-poc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spt-development/testcontainers-python-poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Ftestcontainers-python-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Ftestcontainers-python-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Ftestcontainers-python-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Ftestcontainers-python-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spt-development","download_url":"https://codeload.github.com/spt-development/testcontainers-python-poc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spt-development%2Ftestcontainers-python-poc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270742043,"owners_count":24637504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:11:35.502Z","updated_at":"2025-08-16T17:04:10.737Z","avatar_url":"https://github.com/spt-development.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tescontainers-python POC\n\nThe aim of this project is to POC the use of \n[testcontainers-python](https://testcontainers-python.readthedocs.io/en/latest/) for integration testing python code. \nThe project aims to demonstrate the following:\n\n1. Integration of testcontainers-python with [behave](https://behave.readthedocs.io/en/latest/) (or similar python \nCucumber port).\n2. The spinning up of a generic container - running RabbitMQ in this case.\n3. Waiting for the application running in the container to finish initializing.\n4. Interacting with the application running inside the test container.\n\n## Running\n\nTo run the project code and the associated integration tests, initialize a virtual environment.\n\n    $ python3 -m venv ./.venv \u0026\u0026 source .venv/bin/activate \u0026\u0026 pip install -r requirements.txt\n    (.venv) $\n    \nIt is assumed that docker will have been installed and is running on the machine being used.\n    \n### simple_http_server.py\n\n`simple_http_server.py` is the simple application that is being tested. It is a very simple web server that returns\n'Hello, world!' in response to `GET` requests and adds the contents of the request body to RabbitMQ when a `POST` request\nis received. \n\nTo manually test the application, spin up a docker container running RabbitMQ:\n\n    $ docker run -d --hostname my-rabbit -p 15672:15672 -p 5672:5672 --name some-rabbit rabbitmq:3.8.3-management\n    \nRun the simple web server specifying the http port to listen for requests on and the rabbit port to send messages on:\n\n    $ source .venv/bin/activate\n    (.venv) $ python3 simple_http_server.py 8082 5672\n    \nInteract with the web server using cURL:\n\n    $ curl http://localhost:8082\n      Hello, world!\n    $\n    $ curl -v http://localhost:8082 -d'[{\"hello\":\"world\"}]'\n      *   Trying ::1...\n      * TCP_NODELAY set\n      * Connection failed\n      * connect to ::1 port 8082 failed: Connection refused\n      *   Trying 127.0.0.1...\n      * TCP_NODELAY set\n      * Connected to localhost (127.0.0.1) port 8082 (#0)\n      \u003e POST / HTTP/1.1\n      \u003e Host: localhost:8082\n      \u003e User-Agent: curl/7.64.1\n      \u003e Accept: */*\n      \u003e Content-Length: 19\n      \u003e Content-Type: application/x-www-form-urlencoded\n      \u003e \n      * upload completely sent off: 19 out of 19 bytes\n      * HTTP 1.0, assume close after body\n      \u003c HTTP/1.0 201 Created\n      \u003c Server: BaseHTTP/0.6 Python/3.7.7\n      \u003c Date: Fri, 27 Mar 2020 13:33:16 GMT\n      \u003c \n      * Closing connection 0\n    $\n    \nBrowse to http://localhost:15672/#/queues/%2F/test_queue using the credentials guest:guest to view the queue and see \nthe 'hello world' message added to the queue.\n\n### Running the integration tests\n\nTo run the integration tests making use of testcontainers-python, activate the virtual environment and run `behave`:\n\n    $ source .venv/bin/activate\n    (.venv) $ behave\n\n    Pulling image rabbitmq:3.8.3-management\n    ⠇\n    Container started:  00c3b92042\n    Feature: Testcontainers POC: demonstrates use of Testcontainers for integration testing # features/everything.feature:1\n\n      Scenario: When a GET request is made to the simple webserver, a successful 'Hello World' response is returned  # features/everything.feature:3\n        When a GET request is made to the simple webserver                                                           # features/steps/steps.py:12 0.004s\n        Then the webserver will respond with a HTTP status of \"200\"                                                  # features/steps/steps.py:27 0.000s\n        And the response body will contain \"Hello, world!\"                                                           # features/steps/steps.py:32 0.000s\n\n      Scenario: When a POST request is made to the simple webserve, the request body is added to the RabbitMQ queue  # features/everything.feature:8\n        When a POST request is made to the simple webserver                                                          # features/steps/steps.py:17 0.033s\n        Then the webserver will respond with a HTTP status of \"201\"                                                  # features/steps/steps.py:27 0.000s\n        And the response body will be empty                                                                          # features/steps/steps.py:37 0.000s\n        And the request body is added to the RabbitMQ queue                                                          # features/steps/steps.py:42 0.027s\n\n    1 feature passed, 0 failed, 0 skipped\n    2 scenarios passed, 0 failed, 0 skipped\n    7 steps passed, 0 failed, 0 skipped, 0 undefined\n    Took 0m0.065s\n    (.venv) $\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspt-development%2Ftestcontainers-python-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspt-development%2Ftestcontainers-python-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspt-development%2Ftestcontainers-python-poc/lists"}