Skip to content

Commit 7f67d56

Browse files
committed
Add simple test autodiscovery
1 parent 440d06b commit 7f67d56

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

discover_tests.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Simple auto test discovery.
3+
4+
From http://stackoverflow.com/a/17004409
5+
"""
6+
import os
7+
import sys
8+
import unittest
9+
10+
def additional_tests():
11+
setup_file = sys.modules['__main__'].__file__
12+
setup_dir = os.path.abspath(os.path.dirname(setup_file))
13+
return unittest.defaultTestLoader.discover(setup_dir)

setup.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1+
#!/usr/bin/env python
12

3+
import os
24
import sys
3-
setup_kwds = {}
4-
5-
from distutils.core import setup
5+
try:
6+
from setuptools import setup
7+
except ImportError:
8+
from distutils.core import setup
69

710
import future
811

12+
13+
if sys.argv[-1] == 'publish':
14+
os.system('python setup.py sdist upload')
15+
sys.exit()
16+
917
NAME = "future"
1018
PACKAGES = ["future", "future.features", "future.tests"]
19+
PACKAGE_DATA = {'': ['README.rst', 'LICENSE']}
20+
REQUIRES = []
1121
VERSION = future.__version__
1222
DESCRIPTION = "[experimental] support Python 2 with fewer warts"
1323
LONG_DESC = future.__doc__
@@ -18,14 +28,17 @@
1828
KEYWORDS = "future python3 migration backport"
1929
CLASSIFIERS = [
2030
"Programming Language :: Python",
21-
"Programming Language :: Python :: 2",
31+
"Programming Language :: Python :: 2.7",
2232
"Programming Language :: Python :: 3",
33+
"Programming Language :: Python :: 3.3",
2334
"License :: OSI Approved",
2435
"License :: OSI Approved :: MIT License",
2536
"Development Status :: 3 - Alpha",
2637
"Intended Audience :: Developers",
2738
]
2839

40+
setup_kwds = {}
41+
2942
setup(name=NAME,
3043
version=VERSION,
3144
author=AUTHOR,
@@ -36,7 +49,11 @@
3649
license=LICENSE,
3750
keywords=KEYWORDS,
3851
packages=PACKAGES,
52+
package_data=PACKAGE_DATA,
53+
include_package_data=True,
54+
install_requires=REQUIRES,
3955
classifiers=CLASSIFIERS,
56+
test_suite = "discover_tests",
4057
**setup_kwds
4158
)
4259

0 commit comments

Comments
 (0)