-
Notifications
You must be signed in to change notification settings - Fork 56
Check if environment has skimage before running tests #2102
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
Conversation
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.
I'll run and check they resolve!
Is this where we want them to live?
|
This might take some thinking about. Considering first the basic Below are my outputs (truncated), running the v24.3.0 tests. It seems we need to add a I think this means potentially we need a Separately we could have periodic tests to confirm this tagged environment can still be created and pass tests. The tests that need to pass are those from the associated tag. v24.3.0 tests: ----------------------------------------------------------------------
TEST SYSTEM CONFIGURATION
CIL version: 24.3.0
{'has_astra': False,
'has_ccpi_regularisation': False,
'has_cvxpy': False,
'has_ipp': True,
'has_numba': True,
'has_nvidia': True,
'has_tigre': False,
'has_tomophantom': False}
----------------------------------------------------------------------
======================================================================
ERROR: test_reconstructors (unittest.loader._FailedTest.test_reconstructors)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_reconstructors
Traceback (most recent call last):
File "C:\Users\tpc56154\miniforge3\envs\cil\Lib\unittest\loader.py", line 396, in _find_test_path
module = self._get_module_from_name(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tpc56154\miniforge3\envs\cil\Lib\unittest\loader.py", line 339, in _get_module_from_name
__import__(name)
File "C:\Users\tpc56154\GitHub\CIL\Wrappers\Python\test\test_reconstructors.py", line 23, in <module>
from skimage.transform.radon_transform import _get_fourier_filter as skimage_get_fourier_filter
ModuleNotFoundError: No module named 'skimage'
======================================================================
FAIL: test_bb_converge (test_stepsizes.TestStepSizeBB.test_bb_converge)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\tpc56154\GitHub\CIL\Wrappers\Python\test\test_stepsizes.py", line 303, in test_bb_converge
self.assertNumpyArrayAlmostEqual(alg.x.as_array(), alg_true.x.as_array(), decimal=2)
File "C:\Users\tpc56154\GitHub\CIL\Wrappers\Python\test\testclass.py", line 60, in assertNumpyArrayAlmostEqual
np.testing.assert_array_almost_equal(first, second, decimal)
File "C:\Users\tpc56154\miniforge3\envs\cil\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\tpc56154\miniforge3\envs\cil\Lib\site-packages\numpy\testing\_private\utils.py", line 1034, in assert_array_almost_equal
assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
File "C:\Users\tpc56154\miniforge3\envs\cil\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\tpc56154\miniforge3\envs\cil\Lib\site-packages\numpy\testing\_private\utils.py", line 797, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 2 decimals
Mismatched elements: 10 / 10 (100%)
Max absolute difference: 0.04203627
Max relative difference: 0.2293641
x: array([-0.23, -0.26, 0.51, 0.24, 0.5 , -0.51, 0.2 , 0.39, -0.61,
0.6 ], dtype=float32)
y: array([-0.18, -0.24, 0.54, 0.27, 0.52, -0.48, 0.23, 0.43, -0.58,
0.62], dtype=float32)
----------------------------------------------------------------------
Ran 950 tests in 84.803s
FAILED (failures=1, errors=1, skipped=251)
(cil)
|
|
----------------------------------------------------------------------
TEST SYSTEM CONFIGURATION
CIL version: 24.3.0
{'has_astra': True,
'has_ccpi_regularisation': True,
'has_cvxpy': False,
'has_ipp': True,
'has_numba': True,
'has_nvidia': True,
'has_tigre': True,
'has_tomophantom': True}
----------------------------------------------------------------------
======================================================================
FAIL: test_bb_converge (test_stepsizes.TestStepSizeBB.test_bb_converge)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\tpc56154\GitHub\CIL\Wrappers\Python\test\test_stepsizes.py", line 303, in test_bb_converge
self.assertNumpyArrayAlmostEqual(alg.x.as_array(), alg_true.x.as_array(), decimal=2)
File "C:\Users\tpc56154\GitHub\CIL\Wrappers\Python\test\testclass.py", line 60, in assertNumpyArrayAlmostEqual
np.testing.assert_array_almost_equal(first, second, decimal)
File "C:\Users\tpc56154\miniforge3\envs\cil_demos\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\tpc56154\miniforge3\envs\cil_demos\Lib\site-packages\numpy\testing\_private\utils.py", line 1034, in assert_array_almost_equal
assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
File "C:\Users\tpc56154\miniforge3\envs\cil_demos\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\tpc56154\miniforge3\envs\cil_demos\Lib\site-packages\numpy\testing\_private\utils.py", line 797, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 2 decimals
Mismatched elements: 10 / 10 (100%)
Max absolute difference: 0.04203627
Max relative difference: 0.2293641
x: array([-0.23, -0.26, 0.51, 0.24, 0.5 , -0.51, 0.2 , 0.39, -0.61,
0.6 ], dtype=float32)
y: array([-0.18, -0.24, 0.54, 0.27, 0.52, -0.48, 0.23, 0.43, -0.58,
0.62], dtype=float32)
----------------------------------------------------------------------
Ran 981 tests in 151.968s
FAILED (failures=1, skipped=54)
|
|
----------------------------------------------------------------------
TEST SYSTEM CONFIGURATION
CIL version: 24.3.0
{'has_astra': True,
'has_ccpi_regularisation': True,
'has_cvxpy': True,
'has_ipp': True,
'has_numba': True,
'has_nvidia': True,
'has_tigre': True,
'has_tomophantom': True}
----------------------------------------------------------------------
======================================================================
FAIL: test_bb_converge (test_stepsizes.TestStepSizeBB.test_bb_converge)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\tpc56154\GitHub\CIL\Wrappers\Python\test\test_stepsizes.py", line 303, in test_bb_converge
self.assertNumpyArrayAlmostEqual(alg.x.as_array(), alg_true.x.as_array(), decimal=2)
File "C:\Users\tpc56154\GitHub\CIL\Wrappers\Python\test\testclass.py", line 60, in assertNumpyArrayAlmostEqual
np.testing.assert_array_almost_equal(first, second, decimal)
File "C:\Users\tpc56154\miniforge3\envs\cil_test\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\tpc56154\miniforge3\envs\cil_test\Lib\site-packages\numpy\testing\_private\utils.py", line 1034, in assert_array_almost_equal
assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
File "C:\Users\tpc56154\miniforge3\envs\cil_test\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\tpc56154\miniforge3\envs\cil_test\Lib\site-packages\numpy\testing\_private\utils.py", line 797, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 2 decimals
Mismatched elements: 10 / 10 (100%)
Max absolute difference: 0.04203627
Max relative difference: 0.2293641
x: array([-0.23, -0.26, 0.51, 0.24, 0.5 , -0.51, 0.2 , 0.39, -0.61,
0.6 ], dtype=float32)
y: array([-0.18, -0.24, 0.54, 0.27, 0.52, -0.48, 0.23, 0.43, -0.58,
0.62], dtype=float32)
----------------------------------------------------------------------
Ran 981 tests in 149.922s
FAILED (failures=1, skipped=40)
|
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.
due to #2118, the recipe/cil_*.yml files can be moved to sections in pyproject.toml's [dependency-groups] table
|
alternatively, shouldn't we add these files to the CIL-Demos repo directly instead of here? Then CIL's CI could do pytest .
git clone https://github.com/TomographicImaging/CIL-Demos
sed -ri '/- cil($|\s|[<>=])/d' ./CIL-Demos/environment.yml # remove CIL
conda install --file ./CIL-Demos/environment.yml
pytest --nbval ./CIL-Demos/.../some_notebook.ipynb |
|
Moved the environment files to a separate repo https://github.com/TomographicImaging/Build-scripts/pull/1] |
Signed-off-by: Hannah Robarts <[email protected]>
|
Tested skipping skimage using:
|
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.
I'm not going to approve as this is deeply unpythonic, but I'm also not going to request changes as it's committing the same crimes as the rest of the existing codebase.
I wash my hands off this abomination :)
cough #2172
Description
Check if skimage is installed before tests that require it.
Now skips tests if skimage not installed
Closes #2165
blame GH for this text: https://github.com/orgs/community/discussions/81319
Changes
Testing you performed
Related issues/links
Checklist
Contribution Notes
Please read and adhere to the developer guide and local patterns and conventions.