How to use test_install_error method in tox

Best Python code snippet using tox_python

0019_add_skip_tool_test_table_and_test_install_error_column.py

Source:0019_add_skip_tool_test_table_and_test_install_error_column.py Github

copy

Full Screen

1"""2Migration script to add the skip_tool_test table and add the test_install_error column to the repository_metadata table.3"""4import datetime5import logging6import sys7from sqlalchemy import (8 Boolean,9 Column,10 DateTime,11 ForeignKey,12 Integer,13 MetaData,14 Table,15 TEXT,16)17from sqlalchemy.exc import NoSuchTableError18# Need our custom types, but don't import anything else from model19from galaxy.model.custom_types import TrimmedString20log = logging.getLogger(__name__)21log.setLevel(logging.DEBUG)22handler = logging.StreamHandler(sys.stdout)23format = "%(name)s %(levelname)s %(asctime)s %(message)s"24formatter = logging.Formatter(format)25handler.setFormatter(formatter)26log.addHandler(handler)27now = datetime.datetime.utcnow28metadata = MetaData()29SkipToolTest_table = Table(30 "skip_tool_test",31 metadata,32 Column("id", Integer, primary_key=True),33 Column("create_time", DateTime, default=now),34 Column("update_time", DateTime, default=now, onupdate=now),35 Column("repository_metadata_id", Integer, ForeignKey("repository_metadata.id"), index=True),36 Column("initial_changeset_revision", TrimmedString(255), index=True),37 Column("comment", TEXT),38)39def upgrade(migrate_engine):40 print(__doc__)41 metadata.bind = migrate_engine42 metadata.reflect()43 # Initialize.44 if migrate_engine.name == "mysql" or migrate_engine.name == "sqlite":45 default_false = "0"46 elif migrate_engine.name in ["postgresql", "postgres"]:47 default_false = "false"48 try:49 RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True)50 except NoSuchTableError:51 RepositoryMetadata_table = None52 log.debug("Failed loading table repository_metadata.")53 if RepositoryMetadata_table is not None:54 # Create the test_install_error column.55 c = Column("test_install_error", Boolean, default=False, index=True)56 try:57 c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_ttie")58 assert c is RepositoryMetadata_table.c.test_install_error59 migrate_engine.execute(f"UPDATE repository_metadata SET test_install_error={default_false}")60 except Exception:61 log.exception("Adding test_install_error column to the repository_metadata table failed.")62 # Create skip_tool_test table.63 try:64 SkipToolTest_table.create()65 except Exception:66 log.exception("Creating the skip_tool_test table failed.")67def downgrade(migrate_engine):68 metadata.bind = migrate_engine69 metadata.reflect()70 # Drop the skip_tool_test table.71 try:72 SkipToolTest_table.drop()73 except Exception:74 log.exception("Dropping the skip_tool_test table failed.")75 # Drop test_install_error column from the repository_metadata table.76 RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True)77 try:78 RepositoryMetadata_table.c.test_install_error.drop()79 except Exception:...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful