How to use verbosity1 method in tox

Best Python code snippet using tox_python

test_abridge_db_for_sqlite.py

Source:test_abridge_db_for_sqlite.py Github

copy

Full Screen

1from sqlite3 import OperationalError2from tempfile import NamedTemporaryFile3import os4import pytest5import subprocess6from abridger.abridge_db import main7from abridger.database.sqlite import SqliteDatabase8from test.abridge_db_test_utils import TestAbridgeDbBase9class TestAbridgeDbForSqlite(TestAbridgeDbBase):10 def prepare_src(self):11 self.src = NamedTemporaryFile(mode='wt', suffix='.sqlite3')12 self.src_database = SqliteDatabase(self.src.name)13 src_conn = self.src_database.connection14 self.create_schema(src_conn)15 self.create_data(src_conn)16 src_conn.commit()17 self.src_database.disconnect()18 def prepare_dst(self, with_schema=True):19 self.dst = NamedTemporaryFile(mode='wt', suffix='.sqlite3')20 self.dst_database = SqliteDatabase(self.dst.name)21 dst_conn = self.dst_database.connection22 if with_schema:23 self.create_schema(dst_conn)24 self.dst_database.disconnect()25 def run_with_dst_database(self, explain=False, verbosity=1):26 src_url = self.src_database.url()27 dst_url = self.dst_database.url()28 super(TestAbridgeDbForSqlite, self).run_with_dst_database(29 src_url, dst_url, self.dst_database, explain=explain,30 verbosity=verbosity)31 def test_success(self, capsys):32 self.prepare_src()33 self.prepare_dst(with_schema=True)34 self.run_with_dst_database()35 out, err = capsys.readouterr()36 def test_failure_rollback(self, capsys):37 self.prepare_src()38 self.prepare_dst(with_schema=False)39 with pytest.raises(OperationalError):40 self.run_with_dst_database()41 out, err = capsys.readouterr()42 def test_explain(self, capsys):43 self.prepare_src()44 self.prepare_dst(with_schema=False)45 with pytest.raises(SystemExit):46 self.run_with_dst_database(explain=True)47 out, err = capsys.readouterr()48 assert 'test1* -> test1.id=2 -> test2.id=2 -> test1.id=2' in out49 assert err == ''50 def test_quiet_output(self, capsys):51 self.prepare_src()52 self.prepare_dst(with_schema=True)53 self.run_with_dst_database(verbosity=0)54 out, err = capsys.readouterr()55 assert len(out) == 056 assert len(err) == 057 def check_verbosity1_output(self, out):58 assert 'Connecting to %s' % self.src_database.url() in out59 assert 'Querying' in out60 assert ('Extraction completed: '61 'fetched rows=7, '62 'tables=2, '63 'queries=3, '64 'depth=2') in out65 def check_verbosity1_output_for_url(self, out):66 self.check_verbosity1_output(out)67 assert 'Connecting to %s' % self.dst_database.url() in out68 assert 'Performing 5 inserts and 2 updates to 2 tables...' in out69 assert 'Data loading completed in' in out70 def check_verbosity1_output_for_file(self, out):71 assert 'Writing SQL for 5 inserts and 2 updates in 2 tables...' in out72 assert 'Done' in out73 def test_default_output(self, capsys):74 self.prepare_src()75 self.prepare_dst(with_schema=True)76 self.run_with_dst_database(verbosity=1)77 out, err = capsys.readouterr()78 self.check_verbosity1_output_for_url(out)79 def test_verbose_output(self, capsys):80 self.prepare_src()81 self.prepare_dst(with_schema=True)82 self.run_with_dst_database(verbosity=2)83 out, err = capsys.readouterr()84 self.check_verbosity1_output_for_url(out)85 assert ('Processing pass=1 queued=0 depth=0 tables=0 '86 'rows=0 table') in out87 assert 'Inserting' in out88 assert 'Updating' in out89 def test_f_and_u_args_mutual_exclusion(self, capsys):90 with pytest.raises(SystemExit):91 main(['foo', 'bar', '-u', 'foo', '-f', 'bar'])92 out, err = capsys.readouterr()93 assert 'Either -u or -f must be passed' in out94 def test_e_f_and_u_args(self, capsys):95 for arg in ['-u', '-f']:96 with pytest.raises(SystemExit):97 main(['foo', 'bar', '-e', arg, 'foo'])98 out, err = capsys.readouterr()99 assert '%s is meaningless when using -e' % arg in out100 def check_statements(self, stmts):101 self.prepare_dst(with_schema=True)102 self.dst_database.connect()103 dst_conn = self.dst_database.connection104 for stmt in stmts.split("\n"):105 if stmt != 'COMMIT;':106 dst_conn.execute(stmt)107 dst_conn.commit()108 self.check_dst_database(self.dst_database)109 def test_output_to_stdout(self):110 self.prepare_src()111 config_tempfile = self.make_config_tempfile()112 executable = os.path.join(113 os.path.dirname(__file__), os.pardir, os.pardir, 'bin',114 'abridge-db')115 stmts = subprocess.check_output([116 executable,117 config_tempfile.name, self.src_database.url(), '-q', '-f', '-']118 ).decode('UTF-8')119 self.check_statements(stmts)120 def test_output_to_file(self, capsys):121 self.prepare_src()122 src_url = self.src_database.url()123 config_tempfile = self.make_config_tempfile()124 dst = NamedTemporaryFile(mode='wb')125 dst.close()126 main([config_tempfile.name, src_url, '-f', dst.name])127 with open(dst.name) as f:128 self.check_statements(f.read())129 out, err = capsys.readouterr()...

Full Screen

Full Screen

test_auto_SVReg.py

Source:test_auto_SVReg.py Github

copy

Full Screen

1# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT2from ..brainsuite import SVReg3def test_SVReg_inputs():4 input_map = dict(5 args=dict(6 argstr="%s",7 ),8 atlasFilePrefix=dict(9 argstr="'%s'",10 position=1,11 ),12 curveMatchingInstructions=dict(13 argstr="'-cur %s'",14 ),15 dataSinkDelay=dict(16 argstr="%s",17 ),18 displayModuleName=dict(19 argstr="'-m'",20 ),21 displayTimestamps=dict(22 argstr="'-t'",23 ),24 environ=dict(25 nohash=True,26 usedefault=True,27 ),28 iterations=dict(29 argstr="'-H %d'",30 ),31 keepIntermediates=dict(32 argstr="'-k'",33 ),34 pialSurfaceMaskDilation=dict(35 argstr="'-D %d'",36 ),37 refineOutputs=dict(38 argstr="'-r'",39 ),40 shortMessages=dict(41 argstr="'-gui'",42 ),43 skipToIntensityReg=dict(44 argstr="'-p'",45 ),46 skipToVolumeReg=dict(47 argstr="'-s'",48 ),49 skipVolumetricProcessing=dict(50 argstr="'-S'",51 ),52 subjectFilePrefix=dict(53 argstr="'%s'",54 mandatory=True,55 position=0,56 ),57 useCerebrumMask=dict(58 argstr="'-C'",59 ),60 useManualMaskFile=dict(61 argstr="'-cbm'",62 ),63 useMultiThreading=dict(64 argstr="'-P'",65 ),66 useSingleThreading=dict(67 argstr="'-U'",68 ),69 verbosity0=dict(70 argstr="'-v0'",71 xor=("verbosity0", "verbosity1", "verbosity2"),72 ),73 verbosity1=dict(74 argstr="'-v1'",75 xor=("verbosity0", "verbosity1", "verbosity2"),76 ),77 verbosity2=dict(78 argstr="'v2'",79 xor=("verbosity0", "verbosity1", "verbosity2"),80 ),81 )82 inputs = SVReg.input_spec()83 for key, metadata in list(input_map.items()):84 for metakey, value in list(metadata.items()):...

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