Repository: nilearn/nilearn

Issue:
Testing Nilearn setup, build, & installation
**What would you like changed/added and why?**
Use AzurePipelines unused additional CI jobs to test Nilearn installation.

**What would be the benefit?**
It will detect and forestall errors during building and installing Niearn preventing the need for PR like #2198 & help detect issues like #1993  . The additional time required for this would be very low.



Discussion:
I guess you're ready for it !

Resolving patch:
diff --git a/continuous_integration/show-python-packages-versions.py b/continuous_integration/show-python-packages-versions.py
--- a/continuous_integration/show-python-packages-versions.py
+++ b/continuous_integration/show-python-packages-versions.py
@@ -1,6 +1,7 @@
 import sys
 
-DEPENDENCIES = ['numpy', 'scipy', 'sklearn', 'joblib', 'matplotlib', 'nibabel']
+DEPENDENCIES = ['numpy', 'scipy', 'scikit-learn', 'joblib', 'matplotlib',
+                'nibabel']
 
 
 def print_package_version(package_name, indent='  '):
diff --git a/nilearn/version.py b/nilearn/version.py
--- a/nilearn/version.py
+++ b/nilearn/version.py
@@ -21,7 +21,7 @@
 # Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
 # 'X.Y.dev0' is the canonical version of 'X.Y.dev'
 #
-__version__ = '0.6.0b'
+__version__ = '0.6.0b0'
 
 _NILEARN_INSTALL_MSG = 'See %s for installation information.' % (
     'http://nilearn.github.io/introduction.html#installation')
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -30,6 +30,20 @@ def is_installing():
     return install_commands.intersection(set(sys.argv))
 
 
+def list_required_packages():
+    required_packages = []
+    required_packages_orig = ['%s>=%s' % (mod, meta['min_version'])
+                              for mod, meta
+                              in _VERSION_GLOBALS['REQUIRED_MODULE_METADATA']
+                              ]
+    for package in required_packages_orig:
+        if package.startswith('sklearn'):
+            package = package.replace('sklearn', 'scikit-learn')
+        required_packages.append(package)
+    required_packages.append('sklearn')
+    return required_packages
+
+
 # Make sources available using relative paths from this file's directory.
 os.chdir(os.path.dirname(os.path.abspath(__file__)))
 
@@ -51,11 +65,6 @@ def is_installing():
         module_check_fn = _VERSION_GLOBALS['_check_module_dependencies']
         module_check_fn(is_nilearn_installing=True)
 
-    install_requires = \
-        ['%s>=%s' % (mod, meta['min_version'])
-            for mod, meta in _VERSION_GLOBALS['REQUIRED_MODULE_METADATA']
-            if not meta['required_at_installation']]
-
     setup(name=DISTNAME,
           maintainer=MAINTAINER,
           maintainer_email=MAINTAINER_EMAIL,
@@ -96,6 +105,6 @@ def is_installing():
                         'nilearn.datasets.tests.data': ['*.*'],
                         'nilearn.datasets.description': ['*.rst'],
                         'nilearn.reporting.data.html': ['*.html']},
-          install_requires=install_requires,
+          install_requires=list_required_packages(),
           python_requires='>=3.5',
           )


Test patch:
diff --git a/nilearn/tests/test_package_installation.py b/nilearn/tests/test_package_installation.py
new file mode 100644
--- /dev/null
+++ b/nilearn/tests/test_package_installation.py
@@ -0,0 +1,17 @@
+from distutils.version import LooseVersion
+
+from nilearn.version import REQUIRED_MODULE_METADATA
+
+
+def test_required_package_installation():
+    for package_specs in REQUIRED_MODULE_METADATA:
+        package = package_specs[0]
+        min_version = package_specs[1]['min_version']
+        imported_package = __import__(package)
+        installed_version = imported_package.__version__
+        assert LooseVersion(installed_version) >= LooseVersion(min_version)
+        print(package, 'min:', min_version, 'installed:', installed_version)
+
+
+if __name__ == '__main__':
+    test_required_package_installation()