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. aws AWS SDK APIs for Python.
  2. bs Math calculate releated functions.
  3. data structure Data Structures operations.
  4. data base Data Base related API/Packages.
  5. docker docker manager API/Packages.
  6. es ElasticSearch related test
  7. fileop File operation related functions
  8. git Git commands opt; GitLab API
  9. jenkinslib libs for jenkins
  10. k8s Kubernetes API.
  11. log logging config, colored, compress, log file/console.
  12. ltp Linux Test Project tools
  13. mail Send email, attachment.
  14. platform Linux/windows platform operations,such as shell,cmd,ssh_manager...
  15. vsphere pyVmomi is the Python SDK for the VMware vSphere API that allows you to manage ESX, ESXi, and vCenter.
  16. retry Decorators for retry func
  17. schedule Decorators for schedule the func task and list the tasks with PrettyTable
  18. storage Object related storage
  19. Stress Runner A TestRunner generates a HTML report to show the result at a glance.
  20. utils Some python utils
  21. validparam Decorators for verify param valid, verify param type, value range, ...
  22. vim-config A easy vim configuration for python

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

How to run test case in this project: - Run test/test_*.py - python run_test.py log - python run_test.py mail - python run_test.py es stress -h - python run_test.py es index -h - ...

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
    |-- docs                    module              Docments
    |-- examples                module              tlib useage examples   
    |-- test                    module              tlib unit test cases
    |-- tlib                    module              tlib packages
    |-- requirements.txt        module              Python package requirements, pip install -r requirements.txt
    |-- Pipfile                 module              Python packages manage with pipenv
    |-- run_test.py             module              An interface for run unit test, python run_test.py -h
    |-- setup.py                module              Setup
....

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.10.tar.gz (197.7 kB view hashes)

Uploaded Source

Built Distribution

tlib-1.2.10-py3-none-any.whl (298.9 kB view hashes)

Uploaded Python 3

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