Skip to content

CarliJoy/testcontainers-java2py

 
 

Repository files navigation

Testcontainers Python

Python port of Testcontainers - a library that supports pytest tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

Repository Organization

This repository contains:

  • Python Implementation (main directory)

    • src/testcontainers/ - Python source code
    • tests/ - Python test suite
    • pyproject.toml - Python package configuration
    • See PROJECT_STATUS.md for detailed implementation status
  • Java Reference Implementation (java_origin/ directory)

    • Original Java testcontainers source code used as reference for the Python port
    • See java_origin/README.md for details

Quick Start

Install the package:

pip install testcontainers-python

Use a container in your tests:

from testcontainers.postgres import PostgresContainer
import sqlalchemy

def test_with_postgres():
    with PostgresContainer("postgres:16") as postgres:
        engine = sqlalchemy.create_engine(postgres.get_connection_url())
        # Your test code here

Documentation

License

See LICENSE.

Copyright

Copyright (c) 2015 - 2021 Richard North and other authors.

MS SQL Server module is (c) 2017 - 2021 G DATA Software AG and other authors.

Hashicorp Vault module is (c) 2017 - 2021 Capital One Services, LLC and other authors.

See contributors for all contributors.

About

This is a Python Conversation of the Java Testcontainers Project in order to use it within testcontainer-python

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 75.5%
  • Python 23.0%
  • Groovy 0.8%
  • CSS 0.3%
  • Kotlin 0.1%
  • Shell 0.1%
  • Other 0.2%