-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distribute tests #669
Distribute tests #669
Changes from all commits
e6cbd6b
84eaea5
5d9b302
d858f33
3bab662
127a73d
1254a48
09ca27c
38d9bcf
9f05097
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
[distutils] | ||
index-servers=pypi | ||
index-servers= | ||
pypi | ||
pypitest | ||
|
||
[pypi] | ||
repository = https://pypi.python.org/pypi | ||
username = kohr-h | ||
repository = https://upload.pypi.org/legacy | ||
username = odlgroup | ||
|
||
[pypitest] | ||
repository = https://test.pypi.org/legacy | ||
username = kohr-h |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,17 +30,12 @@ | |
import sys | ||
|
||
|
||
if os.environ.get('READTHEDOCS', None) == 'True': | ||
# Mock requires in conf.py | ||
requires = '' | ||
test_requires = [] | ||
else: | ||
requires = open( | ||
os.path.join(os.path.dirname(__file__), | ||
'requirements.txt')).readlines() | ||
test_requires = open( | ||
os.path.join(os.path.dirname(__file__), | ||
'test_requirements.txt')).readlines() | ||
root_path = os.path.dirname(__file__) | ||
|
||
|
||
requires = open(os.path.join(root_path, 'requirements.txt')).readlines() | ||
test_requires = open( | ||
os.path.join(root_path, 'test_requirements.txt')).readlines() | ||
|
||
|
||
class PyTest(TestCommand): | ||
|
@@ -61,6 +56,23 @@ def run_tests(self): | |
errno = pytest.main(self.pytest_args) | ||
sys.exit(errno) | ||
|
||
|
||
test_path = os.path.join(root_path, 'odl', 'test') | ||
|
||
|
||
def find_tests(): | ||
tests = [] | ||
for path, _, filenames in os.walk(os.path.join(root_path, test_path)): | ||
for filename in filenames: | ||
basename, suffix = os.path.splitext(filename) | ||
if (suffix == '.py' and | ||
(basename.startswith('test_') or | ||
basename.endswith('_test'))): | ||
tests.append(os.path.join(path, filename)) | ||
|
||
return tests | ||
|
||
|
||
long_description = """ | ||
Operator Discretization Library (ODL) is a Python library for fast prototyping focusing on (but not restricted to) inverse problems. ODL is being developed at `KTH Royal Institute of Technology <https://www.kth.se/en/sci/institutioner/math>`_. | ||
|
||
|
@@ -89,7 +101,7 @@ def run_tests(self): | |
setup( | ||
name='odl', | ||
|
||
version='0.5.0', | ||
version='0.5.1', | ||
|
||
description='Operator Discretization Library', | ||
long_description=long_description, | ||
|
@@ -124,8 +136,11 @@ def run_tests(self): | |
|
||
keywords='research development mathematics prototyping imaging tomography', | ||
|
||
packages=find_packages(exclude=['*test*']), | ||
packages=find_packages(), | ||
package_dir={'odl': 'odl'}, | ||
package_data={'odl': find_tests() + ['odl/pytest.ini']}, | ||
include_package_data=True, | ||
entry_points={'pytest11': ['odl_plugins = odl.util.pytest_plugins']}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this make pytest find it? What does 11 mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is one of the 4 or 5 ways to extend pytest by custom "plugins". The mechanism I used is described here. The name "pytest11" is fixed and magic :-) |
||
|
||
install_requires=[requires], | ||
tests_require=['pytest'], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link has to be wrong now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the other one is inline now, I don't see a point in 3 different targets linking to the same page.