Best Python code snippet using testcontainers-python_python
test_db_containers.py
Source:test_db_containers.py
...24 postgres_container = PostgresContainer("postgres:9.5", driver="pg8000")25 with postgres_container as postgres:26 e = sqlalchemy.create_engine(postgres.get_connection_url())27 e.execute("select 1=1")28def test_docker_run_mariadb():29 with MySqlContainer("mariadb:10.6.5").maybe_emulate_amd64() as mariadb:30 e = sqlalchemy.create_engine(mariadb.get_connection_url())31 result = e.execute("select version()")32 for row in result:33 assert row[0].startswith('10.6.5')34@pytest.mark.skip(reason="needs oracle client libraries unavailable on Travis")35def test_docker_run_oracle():36 with OracleDbContainer() as oracledb:37 e = sqlalchemy.create_engine(oracledb.get_connection_url())38 result = e.execute("select * from V$VERSION")39 versions = {'Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production',40 'PL/SQL Release 11.2.0.2.0 - Production',41 'CORE\t11.2.0.2.0\tProduction',42 'TNS for Linux: Version 11.2.0.2.0 - Production',...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!