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/omego/version.py b/omego/version.py index e6175a7..73f1b65 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 os class Version(yaclifw.version.Version): @@ -32,4 +32,10 @@ class Version(yaclifw.version.Version): def __call__(self, args): super(yaclifw.version.Version, self).__call__(args) - print(resource_string(__name__, 'RELEASE-VERSION').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) 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..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,74 +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): @@ -121,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') 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