Skip to content
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

Tests and continuous integration: Fixed issues and updated CI configuration #4149

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
199f34c
add copy argument to __array__ methods
t20100 Aug 27, 2024
e8bfa3f
Try testing GUI on Windows
t20100 Jun 14, 2024
a970e37
Compare realpath
t20100 Jun 17, 2024
d0a0fad
Rename test files to use pytest default prefix: test_ and use lower case
t20100 Jun 17, 2024
d720d95
Remove setting of test file,class,function: using pytest defaults
t20100 Jun 17, 2024
ce9ab9b
Move handling of warnings as errors to silx.test.run_tests
t20100 Jun 17, 2024
a5f05d7
use silx.test.run_tests instead of run_tests.py to run the tests
t20100 Jun 17, 2024
618ad66
Rework run_tests
t20100 Jun 17, 2024
ab2927f
remove PySide6 pinning
t20100 Jun 18, 2024
7b5a0b1
pin pyside6<6.7 and do not uninstall already installed binding
t20100 Jun 18, 2024
9029ffd
Avoid UserWarning when passing swmr=True and mode!='r' to h5py.File
t20100 Jun 18, 2024
1518c2a
Add filterwarnings for python3.8 CI
t20100 Jun 20, 2024
69a07b5
Change asserts to print both provided and normalized paths
t20100 Jun 24, 2024
f483058
Ignore one more nan warning for test_plotwidget.py::testCurveErrors
t20100 Jun 24, 2024
e849464
change way to deallocate widgets
t20100 Jun 25, 2024
f267bd0
avoid 8.3 filenames on Windows
t20100 Jun 25, 2024
9008b3b
check urls as urls not as path
t20100 Jun 25, 2024
4c6fbb8
use silx.test.run_tests from run_tests.py
t20100 Jun 25, 2024
24228d8
update test matrix and use QT_API env var
t20100 Jun 25, 2024
baefd3c
Disable OpenGL tests on Windows
t20100 Jun 27, 2024
0ec10d9
PySide6>=6.4 has a qWait function, let's use it
t20100 Jul 11, 2024
cbf3a72
Rework profile manager threaded execution to avoid seg fault with
t20100 Jul 11, 2024
8631cdf
run ci on macos x86_64 + disable fast fail
t20100 Jul 11, 2024
d2f7c50
Fix test to delete the widget on close
t20100 Jul 11, 2024
2342c4a
Accept SystemError during signal disconnect: occur in CI with PySide6.7
t20100 Jul 11, 2024
f71d2a7
Change the way to disable OpenGL tests on Windows
t20100 Jul 11, 2024
9fbb889
wait longer for pending operations
t20100 Jul 11, 2024
51e66d4
Try fix test failure
t20100 Jul 12, 2024
ba6e7dc
try to fix test
t20100 Jul 12, 2024
96b0e64
Wait longer
t20100 Jul 12, 2024
62f5df6
avoid the venv to be a sub-folder of the project dir
t20100 Jul 12, 2024
821f0dc
Update ignored warnings
t20100 Aug 29, 2024
30abd19
disable gl test on all OS but Windows
t20100 Aug 29, 2024
6e4e93e
ignore __array__ copy argument until h5py v3.12 is released
t20100 Aug 29, 2024
dbdb3a0
disable all OpenGL tests
t20100 Aug 29, 2024
ed6d500
re-enable OpenGL tests on Windows
t20100 Aug 29, 2024
dfdc725
simplify ci config
t20100 Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 51 additions & 99 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: CI

on:
# Triggers the workflow on push only for the master branch or pull request events
push:
branches: [master]
branches: [main]
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

defaults:
Expand All @@ -16,134 +13,89 @@ defaults:
jobs:
# This workflow contains a single job called "build"
build:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.name-suffix }}"
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.QT_API }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name-suffix: "PyQt5 sdist"
os: ubuntu-20.04
- os: ubuntu-20.04
python-version: "3.8"
BUILD_OPTION: --sdist
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to test --sdist, python -m build does so

QT_BINDING: PyQt5
RUN_TESTS_OPTIONS: --qt-binding=PyQt5 --no-opencl --low-mem
- name-suffix: "PyQt5 wheel"
os: macos-latest
python-version: "3.10"
BUILD_OPTION: --wheel
QT_BINDING: PyQt5
RUN_TESTS_OPTIONS: --qt-binding=PyQt5 --no-opencl --low-mem
QT_API: PyQt5
- os: ubuntu-latest
python-version: "3.11"
QT_API: PyQt6
- os: ubuntu-latest
python-version: "3.12"
QT_API: PySide6

- name-suffix: "PySide6 sdist"
os: ubuntu-latest
python-version: "3.8"
BUILD_OPTION: --sdist
QT_BINDING: PySide6
RUN_TESTS_OPTIONS: --qt-binding=PySide6 --no-opencl --low-mem
- name-suffix: "PySide6 wheel"
os: macos-latest
- os: macos-13
python-version: "3.10"
QT_API: PyQt5
- os: macos-13
python-version: "3.12"
QT_API: PyQt6
- os: macos-13
python-version: "3.9"
BUILD_OPTION: --wheel
QT_BINDING: "PySide6<6.7"
RUN_TESTS_OPTIONS: --qt-binding=PySide6 --no-opencl --low-mem
QT_API: PySide6

- name-suffix: "PyQt6 wheel"
os: ubuntu-latest
python-version: "3.11"
BUILD_OPTION: --wheel
QT_BINDING: PyQt6
RUN_TESTS_OPTIONS: --qt-binding=PyQt6 --no-opengl --low-mem
- name-suffix: "PyQt6 wheel"
os: macos-latest
python-version: "3.11"
BUILD_OPTION: --wheel
QT_BINDING: PyQt6
RUN_TESTS_OPTIONS: --qt-binding=PyQt6 --no-opencl --low-mem

- name-suffix: "No GUI wheel"
os: windows-latest
- os: windows-latest
python-version: "3.9"
BUILD_COMMAND: --wheel
QT_BINDING: PyQt5
RUN_TESTS_OPTIONS: --no-gui --low-mem
# No GUI tests on Windows
QT_API: PyQt5
- os: windows-latest
python-version: "3.12"
QT_API: PyQt6
- os: windows-latest
python-version: "3.10"
QT_API: PySide6

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4

# Install X server packages
# Install packages:
# OpenCL lib and icd
# xvfb to run the GUI test headless
# libegl1-mesa: Required by Qt xcb platform plugin
# ocl-icd-opencl-dev: OpenCL headers, lib and icd loader
# libgl1-mesa-glx: For OpenGL
# xserver-xorg-video-dummy: For OpenGL
# libxkbcommon-x11-0: needed for Qt plugins
- name: Install X server
# libxkbcommon-x11-0, ..: needed for Qt plugins
- name: Install system packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libegl1-mesa ocl-icd-opencl-dev intel-opencl-icd libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
sudo apt-get install ocl-icd-opencl-dev intel-opencl-icd xvfb libegl1-mesa libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using xvfb simplifies a lot and looks to work fine with OpenGL tests


# Runs a single command using the runners shell
- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Upgrade distribution modules
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build setuptools wheel
pip install --upgrade --pre cython

- name: Print python info used for build
run: |
python ./ci/info_platform.py
pip install --upgrade --pre build cython setuptools wheel
pip list

- name: Generate source package or wheel
- name: Build
env:
MACOSX_DEPLOYMENT_TARGET: "10.9"
run: |
if [ ${{ runner.os }} == 'macOS' ]; then
export MACOSX_DEPLOYMENT_TARGET=10.9;
fi
python -m build --no-isolation ${{ matrix.BUILD_OPTION }}
python -m build --no-isolation
ls dist

- name: Pre-install dependencies
run: |
if [ -s "ci/requirements-pinned.txt" ];
then
pip install -r ci/requirements-pinned.txt;
fi
pip install --pre -r requirements.txt
pip uninstall -y PyQt5 PyQt6 PySide6
pip install --pre "${{ matrix.QT_BINDING }}"

- name: Install pytest
run: |
pip install pytest
pip install pytest-xvfb
pip install pytest-mock

- name: Install silx package
run: pip install --pre --find-links dist/ --no-cache-dir --no-index --no-build-isolation silx

- name: Print python info used for tests
- name: Install
run: |
pip install -r ci/requirements-pinned.txt
pip install --pre "${{ matrix.QT_API }}"
pip install --pre "$(ls dist/silx*.whl)[full,test]"
python ./ci/info_platform.py
pip list

# For Linux: Start X server with dummy video dirver
# Use this instead of Xvfb to have RANDR extension
# Otherwise there is a bug with Qt5.10.0
- name: Run the tests
- name: Test
env:
QT_API: ${{ matrix.QT_API }}
SILX_TEST_LOW_MEM: "False"
run: |
if [ ${{ runner.os }} == 'Linux' ]; then
export OCL_ICD_VENDORS=$(pwd)/intel_opencl_icd/vendors
export DISPLAY=:99.0
Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./99.log -config ./ci/xorg.conf :99 &
sleep 3
if [ ${{ runner.os }} == 'Windows' ]; then
export WITH_GL_TEST=False
fi
echo "RUN_TESTS_OPTIONS="${{ matrix.RUN_TESTS_OPTIONS }}
python run_tests.py --installed -v ${{ matrix.RUN_TESTS_OPTIONS }}
python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=1, args=['--qt-binding=${{ matrix.QT_API }}']));"
19 changes: 7 additions & 12 deletions ci/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@ environment:
global:
WIN_SDK_ROOT: "C:\\Program Files\\Microsoft SDKs\\Windows"
VENV_BUILD_DIR: "venv_build"
VENV_TEST_DIR: "venv_test"
VENV_TEST_DIR: "..\\venv_test"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the virtual env to run the tests inside the cloned repo caused trouble to pytest.


matrix:
# Python 3.9
- PYTHON_DIR: "C:\\Python39-x64"
QT_BINDING: "PyQt5"
WITH_GL_TEST: True
QT_API: "PyQt5"
PIP_OPTIONS: "-q --pre"

# Python 3.12
- PYTHON_DIR: "C:\\Python312-x64"
QT_BINDING: "PySide6<6.7"
WITH_GL_TEST: True
QT_API: "PySide6"
PIP_OPTIONS: "-q --pre"

# Python 3.11
- PYTHON_DIR: "C:\\Python311-x64"
QT_BINDING: "PyQt6"
WITH_GL_TEST: True
QT_API: "PyQt6"
PIP_OPTIONS: "-q"


Expand All @@ -56,7 +53,7 @@ install:
- "python -m pip install %PIP_OPTIONS% --upgrade pip"

# Download Mesa OpenGL in Python directory when testing OpenGL
- IF %WITH_GL_TEST%==True curl -fsS -o %PYTHON_DIR%\\opengl32.dll http://www.silx.org/pub/silx/continuous_integration/opengl32_mingw-mesa-x86_64.dll
- curl -fsS -o %PYTHON_DIR%\\opengl32.dll https://www.silx.org/pub/silx/continuous_integration/opengl32_mingw-mesa-x86_64.dll

build_script:
# Create build virtualenv
Expand Down Expand Up @@ -94,8 +91,7 @@ before_test:
- pip install %PIP_OPTIONS% -r requirements.txt

# Install selected Qt binding
- "pip uninstall -y PyQt5 PySide6 PyQt6"
- pip install %PIP_OPTIONS% "%QT_BINDING%"
- pip install %PIP_OPTIONS% "%QT_API%"

# Install pytest
- "pip install %PIP_OPTIONS% pytest"
Expand All @@ -118,8 +114,7 @@ before_test:

test_script:
# Run tests with selected Qt binding and without OpenCL
- echo "WITH_GL_TEST=%WITH_GL_TEST%"
- "python run_tests.py --installed -v --no-opencl --low-mem"
- python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=1, args=('--no-opencl', '--low-mem', '--qt-binding=%QT_API%')));"

after_test:
# Leave test virtualenv
Expand Down
21 changes: 0 additions & 21 deletions ci/xorg.conf

This file was deleted.

13 changes: 0 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,3 @@ safe = true

[tool.pytest.ini_options]
minversion = "6.0"
python_files = [
"test/test*.py",
"test/Test*.py",
]
python_classes = "Test"
python_functions = "test"
Comment on lines -16 to -21
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed, just use pytest default test_*.py

filterwarnings = [
"error",
# note the use of single quote below to denote "raw" strings in TOML
'ignore:tostring\(\) is deprecated. Use tobytes\(\) instead\.:DeprecationWarning:OpenGL',
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
'ignore:Unable to import recommended hash:UserWarning:pytools',
]
Comment on lines -22 to -28
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now defined in silx.test.run_tests

22 changes: 5 additions & 17 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,10 @@ def normalize_option(option):
return os.path.join(PROJECT_PATH, *option_parts[2:])
return option

args = [normalize_option(p) for p in sys.argv[1:] if p != "--installed"]

# Run test on PROJECT_PATH if nothing is specified
without_options = [a for a in args if not a.startswith("-")]
if len(without_options) == 0:
args += [PROJECT_PATH]

argv = ["--rootdir", PROJECT_PATH] + args
test_module = importlib.import_module(f"{PROJECT_NAME}.test")
sys.exit(
subprocess.run(
[
sys.executable,
"-m",
"pytest",
]
+ argv,
check=False,
).returncode
test_module.run_tests(
module=None,
args=[normalize_option(p) for p in sys.argv[1:] if p != "--installed"],
)
Comment on lines +175 to +178
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use silx.test.run_tests

)
Loading