Commit 20e7e610 authored by Manuel Günther's avatar Manuel Günther
Browse files

Fixed test in case numpy or scipy are not available

parent 9c1bf3b4
......@@ -131,13 +131,23 @@ package-z
"""
# test NumPy and SciPy docs
additional_packages = ['numpy', 'scipy']
result = link_documentation(additional_packages, None)
assert len(result) == 2
addresses = result.keys()
assert '/numpy' in addresses[0] or '/numpy' in addresses[1]
assert '/scipy' in addresses[0] or '/scipy' in addresses[1]
assert '/reference' in addresses[0] or '/reference' in addresses[1]
try:
import numpy
result = link_documentation(['numpy'], None)
assert len(result) == 1
assert '/numpy' in result.keys()[0]
except ImportError:
pass
try:
import scipy
result = link_documentation(['scipy'], None)
assert len(result) == 1
assert '/scipy' in result.keys()[0]
assert '/reference' in result.keys()[0]
except ImportError:
pass
# test pypi packages
additional_packages = ['python', 'bob.extension', 'other.bob.package']
......
......@@ -418,7 +418,7 @@ def link_documentation(additional_packages = ['python', 'numpy'], requirements_f
if 'scipy' in packages:
scipy_version = __import__('scipy').version.version
if smaller_than(numpy_version, '0.9.0'):
if smaller_than(scipy_version, '0.9.0'):
scipy_version = '.'.join(scipy_version.split('.')[:-1]) + '.x'
else:
scipy_version = '.'.join(scipy_version.split('.')[:-1]) + '.0'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment