From c639de2cefb10073a755fccb5b194e4e63b74e76 Mon Sep 17 00:00:00 2001 From: Vincent <vincent.pollet@idiap.ch> Date: Mon, 25 Jan 2021 14:28:29 +0100 Subject: [PATCH] Add test for package integrity --- conda/opencv/meta.yaml | 5 ++++- conda/opencv/run_test_opencv.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 conda/opencv/run_test_opencv.py diff --git a/conda/opencv/meta.yaml b/conda/opencv/meta.yaml index 5f8459f6..8960636a 100644 --- a/conda/opencv/meta.yaml +++ b/conda/opencv/meta.yaml @@ -41,7 +41,7 @@ source: sha256: 78884f64b564a3b06dc6ee731ed33b60c6d8cd864cea07f21d94ba0f90c7b310 # [unix] build: - number: 0 + number: 1 string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}_{{ PKG_BUILDNUM }} run_exports: # https://abi-laboratory.pro/index.php?view=timeline&l=opencv @@ -175,6 +175,9 @@ outputs: run: - {{ pin_subpackage('libopencv', exact=True) }} - {{ pin_subpackage('py-opencv', exact=True) }} + - {{ pin_compatible('setuptools') }} + test: + script: run_test_opencv.py - name: py-opencv build: diff --git a/conda/opencv/run_test_opencv.py b/conda/opencv/run_test_opencv.py new file mode 100644 index 00000000..e276f30b --- /dev/null +++ b/conda/opencv/run_test_opencv.py @@ -0,0 +1,29 @@ +import sys + +# couple of imports to see if packages are working +import cv2 +import pkg_resources + + +def test_opencv(): + import cv2 + + print("opencv version: ", cv2.__version__) + + +def _check_package(name, pyname=None): + """Checks if a Python package can be `require()`'d""" + + pyname = pyname or name + print(f"Checking Python setuptools integrity for {name} (pyname: {pyname})") + pkg_resources.require(pyname) + + +def test_setuptools_integrity(): + + _check_package('opencv', 'cv2') + + +# test if opencv installation is sane +test_opencv() +test_setuptools_integrity() -- GitLab