From 2e18d297c97650dbfe9fdbc5af50db3db5eeb987 Mon Sep 17 00:00:00 2001 From: pwalczysko Date: Tue, 17 Feb 2026 15:55:47 +0000 Subject: [PATCH 1/5] Fix-build, remove jenkins tests --- .github/workflows/workflow.yml | 10 +- ci-build | 8 +- setup.py | 2 +- test/integration/test_download.py | 157 +++++++++++++++--------------- tox.ini | 34 ++++--- 5 files changed, 114 insertions(+), 97 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index d71a2c8..ad53413 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -15,15 +15,15 @@ jobs: fail-fast: false matrix: python-version: - - '3.8' + - '3.10' os: - - ubuntu-20.04 + - ubuntu-22.04 commands: - 'install' runs-on: ${{ matrix.os }} services: postgres: - image: postgres:11 + image: postgres:16 env: POSTGRES_DB: omero POSTGRES_PASSWORD: omero @@ -37,9 +37,9 @@ jobs: --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install Ice Java and Python binding - uses: ome/action-ice@v1 + uses: ome/action-ice@v4 - name: Install Python dependencies run: | pip install flake8 tox wheel pytest diff --git a/ci-build b/ci-build index f831fe7..50ae11b 100755 --- a/ci-build +++ b/ci-build @@ -4,6 +4,12 @@ set -e set -u set -x +python --version +pip install setuptools==v71.1.0 +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' +wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null +sudo apt update +sudo apt install postgresql python setup.py test -t test/unit -v python setup.py test -t test/integration -v -m "not slowtest" python setup.py sdist install @@ -29,7 +35,7 @@ if [ $TEST = install ]; then # Check db dump file omego db dump --serverdir OMERO.server --dumpfile omero.pgdump - pg_restore -l omero.pgdump | grep 'dbpatch_versions_trigger' + pg_restore --host=localhost -l omero.pgdump | grep 'dbpatch_versions_trigger' fi #Test a multistage DB upgrade (5.3 -> 5.4) as part of the server upgrade diff --git a/setup.py b/setup.py index 16500f6..6aa1a0f 100755 --- a/setup.py +++ b/setup.py @@ -131,7 +131,7 @@ def run_tests(self): cmdclass={'test': PyTest}, tests_require=[ - 'pytest>4,<5', + 'pytest>4', 'restview', 'mox3', ], diff --git a/test/integration/test_download.py b/test/integration/test_download.py index af9e33e..e0a4a5d 100644 --- a/test/integration/test_download.py +++ b/test/integration/test_download.py @@ -20,7 +20,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from __future__ import division -from past.utils import old_div +# from past.utils import old_div from builtins import object import pytest # noqa @@ -38,72 +38,73 @@ def download(self, *args): main("omego", args=args, items=[("download", DownloadCommand)]) -class TestDownloadJenkins(Downloader): - - def setup_class(self): - self.artifact = 'java' - self.branch = 'OMERO-build' - self.ice = '3.6' - - def testDownloadNoUnzip(self, tmpdir): - with tmpdir.as_cwd(): - self.download('--skipunzip', '--branch', self.branch, - '--ice', self.ice) - files = tmpdir.listdir() - assert len(files) == 1 - - def testDownloadUnzip(self, tmpdir): - with tmpdir.as_cwd(): - self.download('--branch', self.branch, '--ice', self.ice) - files = tmpdir.listdir() - assert len(files) == 2 - - def testDownloadUnzipDir(self, tmpdir): - with tmpdir.as_cwd(): - self.download('--unzipdir', 'OMERO.java', '--branch', self.branch, - '--ice', self.ice) - expected = old_div(tmpdir, 'OMERO.java') - assert expected.exists() - assert expected.isdir() - - def testDownloadSym(self, tmpdir): - with tmpdir.as_cwd(): - self.download('--branch', self.branch, '--ice', self.ice, - '--sym', 'auto') - files = tmpdir.listdir() - assert len(files) == 3 - - expected = old_div(tmpdir, 'OMERO.java') - assert expected.exists() - assert expected.isdir() - - # Part two, if an artifact already exists and is unzipped check - # that a new symlink is created if necessary - self.download('--branch', self.branch, '--ice', self.ice, - '--sym', 'custom.sym') - files2 = tmpdir.listdir() - files2diff = set(files2).symmetric_difference(files) - assert len(files2diff) == 1 - sym2 = files2diff.pop() - assert sym2 == (old_div(tmpdir, 'custom.sym')) - assert sym2.isdir() - - def testDownloadBuildNumber(self): - # Old Jenkins artifacts are deleted so we can't download. - # Instead assert that an AttributeError is raised. - # This is not ideal since this error could occur for other reasons. - branch = self.branch + ':600' - with pytest.raises(AttributeError) as exc: - self.download('--branch', branch, '--ice', self.ice) - assert 'No artifacts' in exc.value.args[0] - - def testDownloadList(self, tmpdir): - self.artifact = '' - self.branch = 'latest' - with tmpdir.as_cwd(): - self.download('--branch', self.branch) - files = tmpdir.listdir() - assert len(files) == 0 +# class TestDownloadJenkins(Downloader): + +# def setup_class(self): +# self.artifact = 'java' +# self.branch = 'OMERO-build' +# self.ice = '3.6' + +# def testDownloadNoUnzip(self, tmpdir): +# with tmpdir.as_cwd(): +# self.download('--skipunzip', '--branch', self.branch, +# '--ice', self.ice) +# files = tmpdir.listdir() +# assert len(files) == 1 + +# def testDownloadUnzip(self, tmpdir): +# with tmpdir.as_cwd(): +# self.download('--branch', self.branch, '--ice', self.ice) +# files = tmpdir.listdir() +# assert len(files) == 2 + +# def testDownloadUnzipDir(self, tmpdir): +# with tmpdir.as_cwd(): +# self.download('--unzipdir', 'OMERO.java', +# '--branch', self.branch, +# '--ice', self.ice) +# expected = old_div(tmpdir, 'OMERO.java') +# assert expected.exists() +# assert expected.isdir() + +# def testDownloadSym(self, tmpdir): +# with tmpdir.as_cwd(): +# self.download('--branch', self.branch, '--ice', self.ice, +# '--sym', 'auto') +# files = tmpdir.listdir() +# assert len(files) == 3 + +# expected = old_div(tmpdir, 'OMERO.java') +# assert expected.exists() +# assert expected.isdir() + +# # Part two, if an artifact already exists and is unzipped check +# # that a new symlink is created if necessary +# self.download('--branch', self.branch, '--ice', self.ice, +# '--sym', 'custom.sym') +# files2 = tmpdir.listdir() +# files2diff = set(files2).symmetric_difference(files) +# assert len(files2diff) == 1 +# sym2 = files2diff.pop() +# assert sym2 == (old_div(tmpdir, 'custom.sym')) +# assert sym2.isdir() + +# def testDownloadBuildNumber(self): +# # Old Jenkins artifacts are deleted so we can't download. +# # Instead assert that an AttributeError is raised. +# # This is not ideal since this error could occur for other reasons. +# branch = self.branch + ':600' +# with pytest.raises(AttributeError) as exc: +# self.download('--branch', branch, '--ice', self.ice) +# assert 'No artifacts' in exc.value.args[0] + +# def testDownloadList(self, tmpdir): +# self.artifact = '' +# self.branch = 'latest' +# with tmpdir.as_cwd(): +# self.download('--branch', self.branch) +# files = tmpdir.listdir() +# assert len(files) == 0 class TestDownloadRelease(Downloader): @@ -123,16 +124,16 @@ def testDownloadNonExistingArtifact(self): self.download('-n', '--release', '5.3', '--ice', '3.3') -class TestDownloadBioFormats(Downloader): +# class TestDownloadBioFormats(Downloader): - def setup_class(self): - self.branch = 'BIOFORMATS-build' +# def setup_class(self): +# self.branch = 'BIOFORMATS-build' - def testDownloadJar(self, tmpdir): - self.artifact = 'formats-api' - with tmpdir.as_cwd(): - self.download('--branch', self.branch) - files = tmpdir.listdir() - assert len(files) == 1 - assert files[0].basename.endswith(".jar") - assert files[0].basename.startswith('formats-api') +# def testDownloadJar(self, tmpdir): +# self.artifact = 'formats-api' +# with tmpdir.as_cwd(): +# self.download('--branch', self.branch) +# files = tmpdir.listdir() +# assert len(files) == 1 +# assert files[0].basename.endswith(".jar") +# assert files[0].basename.startswith('formats-api') diff --git a/tox.ini b/tox.ini index 18e794f..4ed5664 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py27, py38 +envlist = py310 # https://tox.readthedocs.io/en/latest/config.html#conf-requires # Ensure pip is new so we can install manylinux wheel requires = pip >= 19.0.0 @@ -12,24 +12,34 @@ requires = pip >= 19.0.0 [testenv] # Variables used by ci-build -passenv = HOME USER_AGENT TEST +passenv = HOME, USER_AGENT, TEST +allowlist_externals = bash commands = ; python setup.py test -vst test/unit/ - ./ci-build + bash ./ci-build -[testenv:py27ci] -basepython = python2.7 -platform = linux.* -deps = - setuptools>=40.0 - https://github.com/ome/zeroc-ice-py-manylinux/releases/download/0.1.0/zeroc_ice-3.6.5-cp27-cp27mu-manylinux2010_x86_64.whl -[testenv:py38ci] -basepython = python3.8 + +[testenv:py310ci] +basepython = python3.10 platform = linux.* deps = setuptools>=40.0 - https://github.com/ome/zeroc-ice-ubuntu2004/releases/download/0.2.0/zeroc_ice-3.6.5-cp38-cp38-linux_x86_64.whl + https://github.com/glencoesoftware/zeroc-ice-py-linux-x86_64/releases/download/20240202/zeroc_ice-3.6.5-cp310-cp310-manylinux_2_28_x86_64.whl + +; [testenv:py312ci] +; basepython = python3.12 +; platform = linux.* +; deps = +; setuptools>=40.0 +; https://github.com/glencoesoftware/zeroc-ice-py-linux-x86_64/releases/download/20240202/zeroc_ice-3.6.5-cp312-cp312-manylinux_2_28_x86_64.whl + +; [testenv:py311ci] +; basepython = python3.11 +; platform = linux.* +; deps = +; ; setuptools>=40.0 +; https://github.com/glencoesoftware/zeroc-ice-py-linux-x86_64/releases/download/20240202/zeroc_ice-3.6.5-cp311-cp311-manylinux_2_28_x86_64.whl ; [testenv:py27] ; basepython = /CONDA/envs/tox-py27/bin/python From f7f9ac67f5fb6c720d58cbe5a2e3a12b7f1bc3e5 Mon Sep 17 00:00:00 2001 From: William Moore Date: Mon, 16 Feb 2026 21:07:41 +0000 Subject: [PATCH 2/5] replace pkg_resources with importlib.resources --- omego/version.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/omego/version.py b/omego/version.py index e6175a7..2d4dfad 100644 --- a/omego/version.py +++ b/omego/version.py @@ -22,7 +22,7 @@ from __future__ import print_function import yaclifw.version -from pkg_resources import resource_string +import importlib.resources class Version(yaclifw.version.Version): @@ -32,4 +32,5 @@ class Version(yaclifw.version.Version): def __call__(self, args): super(yaclifw.version.Version, self).__call__(args) - print(resource_string(__name__, 'RELEASE-VERSION').rstrip()) + data = importlib.resources.files(__name__).joinpath('RELEASE-VERSION').read_bytes() + print(data.rstrip()) From 793b50829dd9484d892db9fde42f513af116c25e Mon Sep 17 00:00:00 2001 From: William Moore Date: Tue, 17 Feb 2026 10:58:37 +0000 Subject: [PATCH 3/5] Fix long line --- omego/version.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/omego/version.py b/omego/version.py index 2d4dfad..6de6bc1 100644 --- a/omego/version.py +++ b/omego/version.py @@ -32,5 +32,6 @@ class Version(yaclifw.version.Version): def __call__(self, args): super(yaclifw.version.Version, self).__call__(args) - data = importlib.resources.files(__name__).joinpath('RELEASE-VERSION').read_bytes() + data = importlib.resources.files(__name__).joinpath( + 'RELEASE-VERSION').read_bytes() print(data.rstrip()) From 7f85042cc7ad17f00cb355973cabefb676c4f7e8 Mon Sep 17 00:00:00 2001 From: William Moore Date: Tue, 17 Feb 2026 14:45:20 +0000 Subject: [PATCH 4/5] Use different approach for reading RELEASE-VERSION --- omego/version.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/omego/version.py b/omego/version.py index 6de6bc1..73f1b65 100644 --- a/omego/version.py +++ b/omego/version.py @@ -22,7 +22,7 @@ from __future__ import print_function import yaclifw.version -import importlib.resources +import os class Version(yaclifw.version.Version): @@ -32,6 +32,10 @@ class Version(yaclifw.version.Version): def __call__(self, args): super(yaclifw.version.Version, self).__call__(args) - data = importlib.resources.files(__name__).joinpath( - 'RELEASE-VERSION').read_bytes() - print(data.rstrip()) + + # print version from RELEASE-VERSION file + base_dir = os.path.dirname(os.path.abspath(__file__)) + file_path = os.path.join(base_dir, 'RELEASE-VERSION') + with open(file_path, 'r') as f: + data = f.read() + print(data) From 64899ab53ba1e8ebb5b7b47fe90a81e40abda430 Mon Sep 17 00:00:00 2001 From: pwalczysko Date: Tue, 17 Feb 2026 16:18:57 +0000 Subject: [PATCH 5/5] Remove commented-out code --- test/integration/test_download.py | 85 ------------------------------- 1 file changed, 85 deletions(-) diff --git a/test/integration/test_download.py b/test/integration/test_download.py index e0a4a5d..5384eee 100644 --- a/test/integration/test_download.py +++ b/test/integration/test_download.py @@ -20,7 +20,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from __future__ import division -# from past.utils import old_div from builtins import object import pytest # noqa @@ -38,75 +37,6 @@ def download(self, *args): main("omego", args=args, items=[("download", DownloadCommand)]) -# class TestDownloadJenkins(Downloader): - -# def setup_class(self): -# self.artifact = 'java' -# self.branch = 'OMERO-build' -# self.ice = '3.6' - -# def testDownloadNoUnzip(self, tmpdir): -# with tmpdir.as_cwd(): -# self.download('--skipunzip', '--branch', self.branch, -# '--ice', self.ice) -# files = tmpdir.listdir() -# assert len(files) == 1 - -# def testDownloadUnzip(self, tmpdir): -# with tmpdir.as_cwd(): -# self.download('--branch', self.branch, '--ice', self.ice) -# files = tmpdir.listdir() -# assert len(files) == 2 - -# def testDownloadUnzipDir(self, tmpdir): -# with tmpdir.as_cwd(): -# self.download('--unzipdir', 'OMERO.java', -# '--branch', self.branch, -# '--ice', self.ice) -# expected = old_div(tmpdir, 'OMERO.java') -# assert expected.exists() -# assert expected.isdir() - -# def testDownloadSym(self, tmpdir): -# with tmpdir.as_cwd(): -# self.download('--branch', self.branch, '--ice', self.ice, -# '--sym', 'auto') -# files = tmpdir.listdir() -# assert len(files) == 3 - -# expected = old_div(tmpdir, 'OMERO.java') -# assert expected.exists() -# assert expected.isdir() - -# # Part two, if an artifact already exists and is unzipped check -# # that a new symlink is created if necessary -# self.download('--branch', self.branch, '--ice', self.ice, -# '--sym', 'custom.sym') -# files2 = tmpdir.listdir() -# files2diff = set(files2).symmetric_difference(files) -# assert len(files2diff) == 1 -# sym2 = files2diff.pop() -# assert sym2 == (old_div(tmpdir, 'custom.sym')) -# assert sym2.isdir() - -# def testDownloadBuildNumber(self): -# # Old Jenkins artifacts are deleted so we can't download. -# # Instead assert that an AttributeError is raised. -# # This is not ideal since this error could occur for other reasons. -# branch = self.branch + ':600' -# with pytest.raises(AttributeError) as exc: -# self.download('--branch', branch, '--ice', self.ice) -# assert 'No artifacts' in exc.value.args[0] - -# def testDownloadList(self, tmpdir): -# self.artifact = '' -# self.branch = 'latest' -# with tmpdir.as_cwd(): -# self.download('--branch', self.branch) -# files = tmpdir.listdir() -# assert len(files) == 0 - - class TestDownloadRelease(Downloader): def setup_class(self): @@ -122,18 +52,3 @@ def testDownloadRelease(self, tmpdir): def testDownloadNonExistingArtifact(self): with pytest.raises(AttributeError): self.download('-n', '--release', '5.3', '--ice', '3.3') - - -# class TestDownloadBioFormats(Downloader): - -# def setup_class(self): -# self.branch = 'BIOFORMATS-build' - -# def testDownloadJar(self, tmpdir): -# self.artifact = 'formats-api' -# with tmpdir.as_cwd(): -# self.download('--branch', self.branch) -# files = tmpdir.listdir() -# assert len(files) == 1 -# assert files[0].basename.endswith(".jar") -# assert files[0].basename.startswith('formats-api')