diff options
author | Ilya Etingof <etingof@gmail.com> | 2018-07-05 10:33:05 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2018-07-07 15:38:10 +0200 |
commit | 7afa36942e2dfc7557c1504dc1de5e7d42529dec (patch) | |
tree | f397c690ddff098a84dc0228e45eb1b4bcbf0860 /setup.py | |
parent | 212e1b54c3d356e6da8a470187fa185be8aa172e (diff) | |
download | pysnmp-git-add-hlapi-unit-tests.tar.gz |
WIP: Add unit tests covering hlapiadd-hlapi-unit-tests
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -8,6 +8,11 @@ import sys import os +try: + import unittest2 as unittest +except ImportError: + import unittest + classifiers = """\ Development Status :: 5 - Production/Stable Environment :: Console @@ -62,7 +67,7 @@ if py_version < (2, 7): requires.append('ordereddict') try: - from setuptools import setup + from setuptools import setup, Command params = { 'install_requires': requires, @@ -75,7 +80,7 @@ except ImportError: howto_install_setuptools() sys.exit(1) - from distutils.core import setup + from distutils.core import setup, Command params = {} if py_version > (2, 4): @@ -133,4 +138,27 @@ params.update({ 'pysnmp.proto.api'] }) +# handle unittest discovery feature + +class PyTest(Command): + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + suite = unittest.TestLoader().loadTestsFromNames( + ['tests.__main__.suite'] + ) + + unittest.TextTestRunner(verbosity=2).run(suite) + +params['cmdclass'] = { + 'test': PyTest, + 'tests': PyTest, +} + setup(**params) |