Bunch of small refactorings and updates

This commit is contained in:
Ayaz Salikhov
2021-04-17 13:25:23 +03:00
parent e28c630dfc
commit bf9660a054
13 changed files with 32 additions and 36 deletions

View File

@@ -7,12 +7,12 @@ test_packages
This test module tests if R and Python packages installed can be imported.
It's a basic test aiming to prove that the package is working properly.
The goal is to detect import errors that can be caused by incompatibilities between packages for example:
The goal is to detect import errors that can be caused by incompatibilities between packages, for example:
- #1012: issue importing `sympy`
- #966: isssue importing `pyarrow`
This module checks dynmamically, through the `CondaPackageHelper`, only the specified packages i.e. packages requested by `conda install` in the `Dockerfiles`.
This module checks dynamically, through the `CondaPackageHelper`, only the specified packages i.e. packages requested by `conda install` in the `Dockerfile`s.
This means that it does not check dependencies. This choice is a tradeoff to cover the main requirements while achieving reasonable test duration.
However it could be easily changed (or completed) to cover also dependencies `package_helper.installed_packages()` instead of `package_helper.specified_packages()`.
@@ -86,10 +86,7 @@ def packages(package_helper):
def package_map(package):
"""Perform a mapping between the python package name and the name used for the import"""
_package = package
if _package in PACKAGE_MAPPING:
_package = PACKAGE_MAPPING.get(_package)
return _package
return PACKAGE_MAPPING.get(package, package)
def excluded_package_predicate(package):
@@ -136,9 +133,8 @@ def _import_packages(package_helper, filtered_packages, check_function, max_fail
for package in filtered_packages:
LOGGER.info(f"Trying to import {package}")
try:
assert (
check_function(package_helper, package) == 0
), f"Package [{package}] import failed"
assert check_function(package_helper, package) == 0, \
f"Package [{package}] import failed"
except AssertionError as err:
failures[package] = err
if len(failures) > max_failures: