All Projects → testcontainers → Testcontainers Python

testcontainers / Testcontainers Python

Licence: apache-2.0

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Testcontainers Python

Webtau
Webtau (short for web test automation) is a testing API, command line tool and a framework to write unit, integration and end-to-end tests. Test across REST-API, Graph QL, Browser, Database, CLI and Business Logic with consistent set of matchers and concepts. REPL mode speeds-up tests development. Rich reporting cuts down investigation time.
Stars: ✭ 156 (-42.01%)
Mutual labels:  database, selenium
Android Ddp
[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Stars: ✭ 271 (+0.74%)
Mutual labels:  database
Inquiry Deprecated
[DEPRECATED]: Prefer Room by Google, or SQLDelight by Square.
Stars: ✭ 264 (-1.86%)
Mutual labels:  database
Dataux
Federated mysql compatible proxy to elasticsearch, mongo, cassandra, big-table, google datastore
Stars: ✭ 268 (-0.37%)
Mutual labels:  database
Mquery
YARA malware query accelerator (web frontend)
Stars: ✭ 264 (-1.86%)
Mutual labels:  database
Tencent Ml Images
Largest multi-label image database; ResNet-101 model; 80.73% top-1 acc on ImageNet
Stars: ✭ 2,918 (+984.76%)
Mutual labels:  database
Game Datasets
🎮 A curated list of awesome game datasets, and tools to artificial intelligence in games
Stars: ✭ 261 (-2.97%)
Mutual labels:  database
Selenium Document
a document with regard to selenium
Stars: ✭ 274 (+1.86%)
Mutual labels:  selenium
Takeoff
A rapid development environment using docker for convenience.
Stars: ✭ 271 (+0.74%)
Mutual labels:  database
Ggr
A lightweight load balancer used to create big Selenium clusters
Stars: ✭ 268 (-0.37%)
Mutual labels:  selenium
Nodejs Bigquery
Node.js client for Google Cloud BigQuery: A fast, economical and fully-managed enterprise data warehouse for large-scale data analytics.
Stars: ✭ 268 (-0.37%)
Mutual labels:  database
Permazen
Language-Natural Persistence Layer for Java
Stars: ✭ 265 (-1.49%)
Mutual labels:  database
Nora
Nora is a Firebase abstraction layer for FirebaseDatabase and FirebaseStorage
Stars: ✭ 270 (+0.37%)
Mutual labels:  database
Opennars
OpenNARS for Research 3.0+
Stars: ✭ 264 (-1.86%)
Mutual labels:  database
Sequelizer
A GUI Desktop App for export sequelize models from database automatically.
Stars: ✭ 273 (+1.49%)
Mutual labels:  database
Questdb
An open source SQL database designed to process time series data, faster
Stars: ✭ 7,544 (+2704.46%)
Mutual labels:  database
Orm
ORM with clean object design, smart relationship loading and powerful collections.
Stars: ✭ 266 (-1.12%)
Mutual labels:  database
The Endorser
An OSINT tool that allows you to draw out relationships between people on LinkedIn via endorsements/skills.
Stars: ✭ 269 (+0%)
Mutual labels:  selenium
Database validations
Database validations for ActiveRecord
Stars: ✭ 274 (+1.86%)
Mutual labels:  database
Playwright Go
Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
Stars: ✭ 272 (+1.12%)
Mutual labels:  selenium

testcontainers-python

.. image:: https://travis-ci.org/testcontainers/testcontainers-python.svg?branch=master :target: https://travis-ci.org/testcontainers/testcontainers-python .. image:: https://img.shields.io/pypi/v/testcontainers.svg?style=flat-square :target: https://pypi.python.org/pypi/testcontainers .. image:: https://readthedocs.org/projects/testcontainers-python/badge/?version=latest :target: http://testcontainers-python.readthedocs.io/en/latest/?badge=latest

Python port for testcontainers-java that allows using docker containers for functional and integration testing. Testcontainers-python provides capabilities to spin up docker containers (such as a database, Selenium web browser, or any other container) for testing.

Currently available features:

  • Selenium Grid containers
  • Selenium Standalone containers
  • MySql Db container
  • MariaDb container
  • Neo4j container
  • OracleDb container
  • PostgreSQL Db container
  • Microsoft SQL Server container
  • Generic docker containers
  • LocalStack

Installation

The testcontainers package is available from PyPI <https://pypi.org/project/testcontainers/>, and it can be installed using :code:pip. Depending on which containers are needed, you can specify additional dependencies as extras <https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies>:

.. code-block:: bash

# Install without extras
pip install testcontainers
# Install with one or more extras
pip install testcontainers[mysql]
pip install testcontainers[mysql,oracle]

Basic usage

.. code-block:: python

import sqlalchemy
from testcontainers.mysql import MySqlContainer

with MySqlContainer('mysql:5.7.17') as mysql:
    engine = sqlalchemy.create_engine(mysql.get_connection_url())
    version, = engine.execute("select version()").fetchone()
    print(version)  # 5.7.17

The snippet above will spin up a MySql database in a container. The :code:get_connection_url() convenience method returns a :code:sqlalchemy compatible url we use to connect to the database and retrieve the database version.

More extensive documentation can be found at Read The Docs <http://testcontainers-python.readthedocs.io/>_.

Usage within Docker (i.e. in a CI)

When trying to launch a testcontainer from within a Docker container two things have to be provided:

  1. The container has to provide a docker client installation. Either use an image that has docker pre-installed (e.g. the official docker images) or install the client from within the Dockerfile specification.
  2. The container has to have access to the docker daemon which can be achieved by mounting /var/run/docker.sock or setting the DOCKER_HOST environment variable as part of your docker run command.

Setting up a development environment

We recommend you use a virtual environment <https://virtualenv.pypa.io/en/stable/>_ for development. Note that a python version :code:>=3.6 is required. After setting up your virtual environment, you can install all dependencies and test the installation by running the following snippet.

.. code-block:: bash

pip install -r requirements/$(python -c 'import sys; print("%d.%d" % sys.version_info[:2])').txt
pytest -s

Adding requirements ^^^^^^^^^^^^^^^^^^^

We use :code:pip-tools to resolve and manage dependencies. If you need to add a dependency to testcontainers or one of the extras, run :code:pip install pip-tools followed by :code:make requirements to update the requirements files.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].