forked from maxtepkeev/architect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
distribute tests within source package
- Loading branch information
1 parent
9d5ec89
commit b2a29f2
Showing
5 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
recursive-include tests *.py | ||
include README.rst CHANGELOG.rst LICENSE NOTICE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[nosetests] | ||
with-coverage=1 | ||
cover-erase=1 | ||
cover-package=architect | ||
|
||
[bdist_wheel] | ||
universal=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,50 @@ | ||
import os | ||
import sys | ||
|
||
from setuptools import setup, find_packages | ||
from setuptools.command.test import test, DistutilsOptionError | ||
|
||
for name in ('multiprocessing', 'pony'): # https://bugs.python.org/issue15881 | ||
try: | ||
__import__(name) | ||
except ImportError: | ||
pass | ||
|
||
|
||
class NoseTests(test): | ||
user_options = test.user_options + [ | ||
('orm=', None, 'Sets ORM to run tests for'), ('db=', None, 'Sets DB to be used by ORM')] | ||
|
||
def initialize_options(self): | ||
test.initialize_options(self) | ||
self.db = None | ||
self.orm = None | ||
|
||
def finalize_options(self): | ||
test.finalize_options(self) | ||
self.test_args = [] | ||
self.test_suite = True | ||
if self.orm is not None: | ||
if self.db is None: | ||
raise DistutilsOptionError("--orm option can't be used without --db option") | ||
os.environ['DB'] = self.db | ||
os.environ[self.orm.upper()] = '1' | ||
|
||
def run_tests(self): | ||
import nose | ||
nose.run(argv=['nosetests']) | ||
if self.orm is not None: | ||
del os.environ['DB'] | ||
del os.environ[self.orm.upper()] | ||
|
||
tests_require = ['nose', 'coverage'] | ||
|
||
if sys.version_info[:2] < (3, 3): | ||
tests_require.append('mock') | ||
if sys.version_info[:2] == (3, 2): | ||
tests_require[1] = 'coverage<4.0' | ||
if sys.version_info[:2] == (2, 6): | ||
tests_require.append('unittest2') | ||
|
||
exec(open('architect/version.py').read()) | ||
|
||
|
@@ -7,19 +53,21 @@ | |
try: | ||
import argparse | ||
except ImportError: | ||
requirements.append('argparse >= 1.2.1') | ||
requirements.append('argparse>=1.2.1') | ||
|
||
setup( | ||
name='architect', | ||
version=globals()['__version__'], | ||
packages=find_packages(exclude=('tests', 'tests.*')), | ||
packages=find_packages(exclude=('tests',)), | ||
url='https://github.com/maxtepkeev/architect', | ||
license=open('LICENSE').read(), | ||
author='Max Tepkeev', | ||
author_email='[email protected]', | ||
description='A set of tools which enhances ORMs written in Python with more features', | ||
long_description=open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read(), | ||
keywords='architect,django,pony,peewee,sqlalchemy,sqlobject,partition,partitioning,database,table', | ||
tests_require=tests_require, | ||
cmdclass={'test': NoseTests}, | ||
zip_safe=False, | ||
install_requires=requirements, | ||
entry_points={'console_scripts': ['architect = architect.commands:main']}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters