-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
98 lines (74 loc) · 2.64 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import os
import re
import sys
import codecs
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
here = os.path.abspath(os.path.dirname(__file__))
setup_requires = ['pytest', 'tox']
install_requires = ['tox', 'factory-boy', 'requests']
dev_requires = ['pyflakes', 'pep8', 'pylint', 'check-manifest',
'ipython', 'ipdb', 'sphinx', 'sphinx_rtd_theme',
'sphinxcontrib-napoleon']
tests_require = ['pytest-cov', 'pytest-cache', 'pytest-timeout']
# find the first version number in CHANGES
with open(os.path.join(here, 'CHANGES')) as f:
for line in f:
version = line.strip()
if re.search("^[0-9]+\.[0-9]+\.[0-9]+$", version):
break
else:
raise RuntimeError('Could not determine a version from CHANGES file.')
# Get the long description from the relevant file
with codecs.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
class VersionCommand(Command):
description = "print library version"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print(version)
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['--strict', '--verbose', '--tb=long',
'--cov', 'factory_rest', '--cov-report',
'term-missing', 'tests']
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
setup(
name='factory-rest',
version=version,
description='Extension to factory-boy to create fixtures over http',
long_description=long_description,
# The project URL.
url='https://github.com/bertonha/factory-boy-rest',
# Author details
author='Christofer Bertonha',
author_email='[email protected]',
classifiers=[
'Development Status :: 3 - Alpha',
# Who the project is intended for.
'Intended Audience :: Developers',
'Topic :: Software Development :: Testing',
# Supported Python versions.
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
],
keywords='testing test fixtures',
packages=find_packages(exclude=['tests']),
setup_requires=setup_requires,
install_requires=install_requires,
tests_require=tests_require,
extras_require={
'dev': dev_requires,
'test': tests_require,
},
cmdclass={"version": VersionCommand, 'test': PyTest},
)