forked from RKrahl/pytest-dependency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·87 lines (79 loc) · 2.89 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
#! /usr/bin/python
"""pytest-dependency - Manage dependencies of tests
This pytest plugin manages dependencies of tests. It allows to mark
some tests as dependent from other tests. These tests will then be
skipped if any of the dependencies did fail or has been skipped.
"""
__version__ = "0.3.2"
import os
import os.path
import re
from setuptools import setup
import setuptools.command.sdist as st_sdist
def _filter_file(src, dest, subst):
"""Copy src to dest doing substitutions on the fly.
"""
substre = re.compile(r'\$(%s)' % '|'.join(subst.keys()))
def repl(m):
return subst[m.group(1)]
with open(src, "rt") as sf, open(dest, "wt") as df:
while True:
l = sf.readline()
if not l:
break
df.write(re.sub(substre, repl, l))
class sdist(st_sdist.sdist):
def make_release_tree(self, base_dir, files):
st_sdist.sdist.make_release_tree(self, base_dir, files)
if not self.dry_run:
src = "pytest_dependency.py"
dest = os.path.join(base_dir, src)
gitrevfile = ".gitrevision"
if hasattr(os, 'link') and os.path.exists(dest):
os.unlink(dest)
subst = {'DOC': __doc__, 'VERSION': __version__}
if os.path.exists(gitrevfile):
with open(gitrevfile, "rt") as f:
subst['REVISION'] = f.readline().strip()
_filter_file(src, dest, subst)
setup(
name='pytest-dependency',
version=__version__,
description='Manage dependencies of tests',
author='Rolf Krahl',
author_email='[email protected]',
maintainer='Rolf Krahl',
maintainer_email='[email protected]',
url='https://github.com/RKrahl/pytest-dependency',
license='Apache Software License 2.0',
long_description=__doc__,
project_urls={
'Documentation': 'https://pytest-dependency.readthedocs.io/',
'Source Code': 'https://github.com/RKrahl/pytest-dependency',
},
py_modules=['pytest_dependency'],
install_requires=['pytest >= 2.8.0'],
classifiers=[
'Development Status :: 4 - Beta',
'Framework :: Pytest',
'Intended Audience :: Developers',
'Topic :: Software Development :: Testing',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Operating System :: OS Independent',
'License :: OSI Approved :: Apache Software License',
],
entry_points={
'pytest11': [
'dependency = pytest_dependency',
],
},
cmdclass = {'sdist': sdist},
)