Skip to content

Commit

Permalink
added tests, updated requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
erickmartins committed Apr 1, 2024
1 parent e992377 commit 2dbf9a0
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/omero_plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ jobs:
repository: ome/omero-test-infra
path: .omero
ref: ${{ secrets.OMERO_TEST_INFRA_REF }}
- name: Build and run OMERO tests
- name: Build and run standard tests
run: POLICY_BINARY_ACCESS=+read,+write,+image,+plate .omero/docker $STAGE
- name: Build and run no-plate tests
run: .omero/docker $STAGE
2 changes: 1 addition & 1 deletion .omero
Submodule .omero updated 4 files
+1 −1 app-build
+2 −1 cli-build
+2 −3 requirements.txt
+2 −1 scripts-build
9 changes: 7 additions & 2 deletions .omeroci/cli-build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -x
TARGET=${TARGET:-..}
cd $TARGET

BIN_ACCESS=$(/opt/omero/server/venv3/bin/omero config get omero.policy.binary_access)

GUESS=${PWD#*omero-cli-*}
PLUGIN=${PLUGIN:-$GUESS}

Expand All @@ -22,5 +24,8 @@ conda activate omero

export OMERO_DIST=${OMERO_DIST:-/opt/omero/server/OMERO.server}
omero $PLUGIN -h

python setup.py test -t test -i ${OMERO_DIST}/etc/ice.config -vs
if [[ $BIN_ACCESS =~ "+plate" ]]; then
python setup.py test -t test -i ${OMERO_DIST}/etc/ice.config -vs -m "not limit_plate"
else
python setup.py test -t test -i ${OMERO_DIST}/etc/ice.config -vs -m limit_plate
fi
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ezomero>=2.0.0
ome-types>=0.4.2
ezomero>=2.0.0<3.0.0
ome-types>=0.5.0<0.6.0
setuptools>=58.0.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def read(fname):
url="https://github.com/TheJacksonLaboratory/omero-cli-transfer",
install_requires=[
'ezomero>=2.1.0, <3.0.0',
'ome-types>=0.5.0,<0.6.0'
'ome-types==0.5.1.post1'
],
extras_require={
"rocrate": ["rocrate==0.7.0"],
Expand Down
1 change: 0 additions & 1 deletion src/omero_cli_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ def __pack(self, args):
args.barchive, args.simple,
args.figure,
self.metadata)

if args.binaries == "all":
print("Starting file copy...")
self._copy_files(path_id_dict, folder, args.ignore_errors,
Expand Down
26 changes: 26 additions & 0 deletions test/integration/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from omero_cli_transfer import TransferControl
from cli import CLITest
from omero.gateway import BlitzGateway
from omero.cli import NonZeroReturnCode

import ezomero
import pytest
Expand All @@ -17,6 +18,9 @@
SUPPORTED = [
"idonly", "imageid", "datasetid", "projectid", "plateid", "screenid"]

PLATESONLY = [
"plateid", "screenid"]

TEST_FILES = [
"test/data/valid_single_image.tar",
"test/data/valid_single_image.zip",
Expand Down Expand Up @@ -149,6 +153,28 @@ def test_pack(self, target_name, tmpdir):
self.cli.invoke(args, strict=True)
self.delete_all()

@pytest.mark.parametrize('target_name', sorted(PLATESONLY))
@pytest.mark.limit_plate
def test_pack_noplate(self, target_name, tmpdir):
self.create_plate(target_name=target_name)
target = getattr(self, target_name)
args = self.args + ["pack", target, str(tmpdir / 'test.tar')]
with pytest.raises(NonZeroReturnCode):
self.cli.invoke(args, strict=True)
assert not (os.path.exists(str(tmpdir / 'test.tar')))
assert not (os.path.exists(str(tmpdir / 'test.tar_folder')))
args = self.args + ["pack", "--binaries", "none", target,
str(tmpdir / 'test.tar')]
self.cli.invoke(args, strict=True)
assert os.path.exists(str(tmpdir / "test" / "transfer.xml"))
assert os.path.getsize(str(tmpdir / "test" / "transfer.xml")) > 0
args = self.args + ["pack", "--ignore_errors", target,
str(tmpdir / 'test_ignore.tar')]
self.cli.invoke(args, strict=True)
assert os.path.exists(str(tmpdir / 'test_ignore.tar'))
assert os.path.getsize(str(tmpdir / 'test_ignore.tar')) > 0
self.delete_all()

@pytest.mark.parametrize('target_name', sorted(SUPPORTED))
def test_pack_special(self, target_name, tmpdir):
if target_name == "datasetid" or target_name == "projectid" or\
Expand Down

0 comments on commit 2dbf9a0

Please sign in to comment.