Completed
Pull Request — master (#145)
by
unknown
04:22
created

PyTest.run_tests()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 4
rs 10
1
#!/usr/bin/env python
2
from __future__ import with_statement
3
import os
4
import sys
5
from setuptools import setup, find_packages
6
from setuptools.command.test import test as TestCommand
7
8
9
class PyTest(TestCommand):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable TestCommand does not seem to be defined.
Loading history...
10
    user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
11
12
    def initialize_options(self):
13
        TestCommand.initialize_options(self)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
14
        self.pytest_args = []
15
16
    def finalize_options(self):
17
        TestCommand.finalize_options(self)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
18
        self.test_args = []
19
        self.test_suite = True
20
21
    def run_tests(self):
22
        import pytest
23
        errno = pytest.main(self.pytest_args)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
24
        sys.exit(errno)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable errno does not seem to be defined.
Loading history...
25
26
27
readme = 'README.md'
28
if os.path.exists('README.rst'):
29
    readme = 'README.rst'
30
with open(readme, 'rb') as f:
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable readme does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable f does not seem to be defined.
Loading history...
31
    long_description = f.read().decode('utf-8')
32
33
with open('requirements.txt') as f:
34
    requirements = [l for l in f.read().splitlines() if l]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable l does not seem to be defined.
Loading history...
35
36
setup(
37
    name='wechatpy',
38
    version='1.2.8',
39
    author='messense',
40
    author_email='[email protected]',
41
    url='https://github.com/messense/wechatpy',
42
    packages=find_packages(),
43
    keywords='WeChat, wexin, SDK',
44
    description='wechatpy: WeChat SDK for Python',
45
    long_description=long_description,
46
    install_requires=requirements,
47
    include_package_data=True,
48
    # namespace_packages=['wechatpy'],
49
    tests_require=[
50
        'pytest',
51
        'httmock',
52
        'redis',
53
        'pymemcache',
54
        'shove',
55
    ],
56
    cmdclass={'test': PyTest},
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable PyTest does not seem to be defined.
Loading history...
57
    classifiers=[
58
        'Development Status :: 5 - Production/Stable',
59
        'License :: OSI Approved :: MIT License',
60
        'Operating System :: MacOS',
61
        'Operating System :: POSIX',
62
        'Operating System :: POSIX :: Linux',
63
        'Programming Language :: Python',
64
        'Programming Language :: Python :: 2.6',
65
        'Programming Language :: Python :: 2.7',
66
        'Programming Language :: Python :: 3.3',
67
        'Programming Language :: Python :: 3.4',
68
        'Programming Language :: Python :: 3.5',
69
        'Programming Language :: Python :: Implementation :: CPython',
70
        'Programming Language :: Python :: Implementation :: PyPy',
71
        'Intended Audience :: Developers',
72
        'Topic :: Software Development :: Libraries',
73
        'Topic :: Software Development :: Libraries :: Python Modules',
74
        'Topic :: Utilities',
75
    ],
76
    extras_require={
77
        'cryptography': ['cryptography'],
78
        'pycrypto': ['pycrypto'],
79
    }
80
)
81