Best Python code snippet using localstack_python
test_logstream.py
Source:test_logstream.py
1from __future__ import print_function2# Copyright (c) 2013, Roger Lew3# All rights reserved.4from collections import OrderedDict5import os6import unittest7from undaqTools import Daq, logstream8from undaqTools.element import FrameSlice9# test file must have step changes in logstream10test_file_large = 'Alaska_0_20130301142422.daq'11class Test_logstream(unittest.TestCase):12 def setUp(self):13 global test_file_large14 hdf5file = test_file_large[:-4]+'.hdf5'15 hdf5file = os.path.join('data', hdf5file)16 17 try:18 with open(hdf5file):19 pass20 except IOError:21 daq = Daq()22 daq.read(os.path.join('data', test_file_large))23 daq.write_hd5(hdf5file)24 def test_find_epochs(self):25 global test_file_large26 hdf5file = test_file_large[:-4]+'.hdf5'27 hdf5file = os.path.join('data', hdf5file)28 daq = Daq()29 daq.read_hd5(hdf5file)30 logstream0 = daq['SCC_LogStreams'][0,:]31 rs = OrderedDict(32 [(1, FrameSlice(start=313314, stop=313826, step=None)), 33 (2, FrameSlice(start=313826, stop=317218, step=None)), 34 (3, FrameSlice(start=317218, stop=317734, step=None)), 35 (11, FrameSlice(start=336734, stop=337242, step=None)), 36 (12, FrameSlice(start=337242, stop=340658, step=None)), 37 (13, FrameSlice(start=340658, stop=341198, step=None)), 38 (21, FrameSlice(start=357834, stop=358330, step=None)), 39 (22, FrameSlice(start=358330, stop=361818, step=None)), 40 (23, FrameSlice(start=361818, stop=362362, step=None)), 41 (31, FrameSlice(start=381626, stop=382126, step=None)), 42 (32, FrameSlice(start=382126, stop=385446, step=None)), 43 (33, FrameSlice(start=385446, stop=385918, step=None)), 44 (41, FrameSlice(start=407334, stop=407814, step=None)), 45 (42, FrameSlice(start=407814, stop=411238, step=None)), 46 (43, FrameSlice(start=411238, stop=411746, step=None))]47 )48 49 epochs = logstream.find_epochs(logstream0)50 51 self.assertEqual(epochs, rs) 52def suite():53 return unittest.TestSuite((54 unittest.makeSuite(Test_logstream)55 ))56if __name__ == "__main__":57 # run tests58 runner = unittest.TextTestRunner()...
test_logs.py
Source:test_logs.py
1import logging2def test_logstream(caplog, capsys):3 from terracotta import logs4 assert logs.use_colors5 logger = logs.set_logger('DEBUG')6 caplog.set_level('DEBUG', logger='terracotta')7 logger.warning('test')8 log_out = caplog.records9 assert len(log_out) == 110 log_out = log_out[0]11 assert 'test' == log_out.message12 assert logs.LEVEL_PREFIX['WARNING'] == log_out.levelshortname13 captured = capsys.readouterr()14 assert '[!]' in captured.err15 assert 'test' in captured.err16def test_logstream_nocolors(monkeypatch, caplog, capsys):...
__main__.py
Source:__main__.py
1import pulumi2import pulumi_aws as aws3test_lambdafunction_logfilter = aws.cloudwatch.LogSubscriptionFilter("testLambdafunctionLogfilter",4 destination_arn=aws_kinesis_stream["test_logstream"]["arn"],5 distribution="Random",6 filter_pattern="logtype test",7 log_group="/aws/lambda/example_lambda_name",...
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!!