Skip to main content

Some own/observed great lib/ideas,common useful python libs

Project description

Over View

Some own/observed great lib/ideas,common useful python libs/utils.

GitHub https://github.com/txu2008/tlib

PyPI: https://pypi.org/project/tlib

Catalogue

  1. vim-config A easy vim configuration for python
  2. Stress Runner A TestRunner generates a HTML report to show the result at a glance.
  3. log logging config, colored, compress, log file/console.
  4. mail Send email, attachment.
  5. bs Math calculate releated functions.
  6. data structure Data Structures operations.
  7. validparam Decorators for verify param valid, verify param type, value range, ...
  8. platform Linux/windows platform operations,such as shell,cmd,ssh...
  9. retry Decorators for retry func
  10. jenkinslib libs for jenkins
  11. fileop File operation related functions
  12. utils Some python utils ...

Quick Start

1. Installation

Install from pip

pip install tlib

Install from source code:

# git clone tlib or download the released tar balls, then:
python setup.py install

2. Doc & Wiki

Visit Wiki to see more details: https://github.com/txu2008/tlib/wiki

Visit Doc site to see py-docs: TODO

Visit examples to see .examples/*

# Examples:

# 1. Init logging logger
from tlib import log
logger = log.get_logger(logfile='test1.log', logger_name='test1', debug=True, reset_logger=True)
logger.info('test_1 start ...')
logger.warning('test_1 hello,world')
logger.debug('test_1 hello,world')
logger.error('test_1 hello,world')
logger.critical('test_1 hello,world')

# 2. stressrunner
import unittest
from tlib.stressrunner import StressRunner
from test.test_mail import TestMail
runner = StressRunner(
        report_path='sr_test.log',
        title='My unit test with stressrunner',
        description='This demonstrates the report output by StressRunner.',
        logger=logger, # support owner logging logger
    )
test_suite = unittest.TestSuite()
test_suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMail))
runner.run(test_suite)

Tests

- Run test/test_*.py
- python run_test.py log
- python run_test.py mail
- ...

Contribute To TLIB

- Commit code to Github, https://github.com/txu2008/tlib
- Need to check pep8 and pylint rules before you start a pull request

Discussion

- Github Issues

Reference

  * http://tungwaiyip.info/software/HTMLTestRunner.html

WIKI

https://github.com/txu2008/tlib/wiki

code directory tree:

tlib/tlib
    |-- stressrunner            module              A TestRunner generates a HTML report to show the result at a glance.
    |-- log                     module              logging config, colored, compress, log file/console.    
    |-- mail                    module              Send email, attachment.
    |-- bs                      module              Math calculate releated functions.
    |-- data_structure          module              Data Structures operations.
    |-- validparam              module              Decorators for verify param valid, verify param type, value range, ...
    |-- platform                module              Linux/windows platform operations,such as shell,cmd,ssh...
    |-- retry                   module              Decorators for retry func
    |-- jenkinslib              module              libs for jenkins
    |-- fileop                  module              File operation related functions
    |-- util                    package             common func utils, etc
    |-- __init__.py             module              Default __init__.py
    |-- cache.py                module              Memory cache related module
    |-- decorators.py           module              Decorators of python
    |-- err.py                  module              Exception classes for tlib
    |-- version.py              module              TLIB Version
....

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tlib-1.2.5.tar.gz (105.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page