PyTest.run_tests()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
1
# Copyright (c) 2016 Fabian Kochem
2
3
4
try:
5
    from setuptools import setup, find_packages, Command
6
except ImportError:
7
    from ez_setup import use_setuptools
8
    use_setuptools()
9
    from setuptools import setup, find_packages, Command
10
11
import platform
12
import os
13
import subprocess
14
import sys
15
16
from setuptools.command.test import test as TestCommand
17
18
19
class PyTest(TestCommand):
20
    user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
21
22
    def initialize_options(self):
23
        TestCommand.initialize_options(self)
24
        self.pytest_args = []
25
26
    def finalize_options(self):
27
        TestCommand.finalize_options(self)
28
        self.test_args = []
29
        self.test_suite = True
30
31
    def run_tests(self):
32
        #import here, cause outside the eggs aren't loaded
33
        import pytest
34
        errno = pytest.main(self.pytest_args)
35
        sys.exit(errno)
36
37
38
if platform.python_implementation() == 'PyPy':
39
    psycopg2_dependency = 'psycopg2cffi==2.7.2'
40
else:
41
    psycopg2_dependency = 'psycopg2==2.6.1'
42
43
44
setup(
45
    name='libtree',
46
    version='6.0.1',
47
    author='Fabian Kochem',
48
    author_email='[email protected]',
49
    description='Python Tree Library',
50
    url='https://github.com/conceptsandtraining/libtree',
51
52
    # Dependencies
53
    install_requires=[
54
        psycopg2_dependency
55
    ],
56
    tests_require=[
57
        'pytest',
58
        'mock'
59
    ],
60
61
    cmdclass={
62
        'test': PyTest
63
    },
64
    entry_points={},
65
    packages=find_packages(),
66
    zip_safe=False,
67
    include_package_data=True,
68
69
    classifiers=[
70
        'Development Status :: 3 - Alpha',
71
        'Intended Audience :: Developers',
72
        'License :: OSI Approved :: MIT License',
73
        'Operating System :: OS Independent',
74
        'Programming Language :: Python',
75
        'Programming Language :: Python :: 2',
76
        'Programming Language :: Python :: 3',
77
        'Topic :: Database',
78
        'Topic :: Software Development :: Libraries'
79
    ],
80
)
81