Skip to content

Commit 91174e2

Browse files
authored
Merge pull request #141 from pwalczysko/restore-tests
Restore tests
2 parents f71c2b7 + e0a1fd4 commit 91174e2

3 files changed

Lines changed: 93 additions & 17 deletions

File tree

README.rst

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
OME, Go (omego)
22
===============
33

4-
.. image:: https://github.com/ome/omego/actions/workflows/workflow.yml/badge.svg
4+
.. image:: https://github.com/ome/omego/workflows/OMERO/badge.svg
55
:target: https://github.com/ome/omego/actions
66

77
.. image:: https://badge.fury.io/py/omego.svg
@@ -12,18 +12,6 @@ The omego command provides utilities for installing and managing OME application
1212
Getting Started
1313
---------------
1414

15-
For Python 2.6, you will need to install `argparse`_
16-
17-
::
18-
19-
$ pip install argparse
20-
21-
With that, it's possible to execute omego:
22-
23-
::
24-
25-
$ python omego/main.py
26-
2715
Pip installation
2816
-----------------
2917

@@ -43,5 +31,3 @@ Copyright
4331
---------
4432

4533
2013-2026, The Open Microscopy Environment
46-
47-
.. _argparse: http://pypi.python.org/pypi/argparse

ci-build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ omego -h
2222
#Install a new server without web
2323
#Tests rely on a non-zero error code being returned on failure
2424
if [ $TEST = install ]; then
25-
export OMERODIR='./OMERO.server-5.6.4-ice36-b232'
26-
omego install --initdb --dbhost localhost --dbname omero --prestartfile $HOME/config.omero -v --release 5.6.4 --ice 3.6 --no-web --no-start
25+
export OMERODIR='./OMERO.server-5.6.17-ice36'
26+
omego install --initdb --dbhost localhost --dbname omero --prestartfile $HOME/config.omero -v --release 5.6.17 --ice 3.6 --no-web --no-start
2727

2828
ls OMERO.server
2929
# Should return 0 DB_UPTODATE

test/integration/test_download.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2121

2222
from __future__ import division
23+
from past.utils import old_div
2324
from builtins import object
2425
import pytest # noqa
2526

@@ -37,6 +38,79 @@ def download(self, *args):
3738
main("omego", args=args, items=[("download", DownloadCommand)])
3839

3940

41+
class TestDownloadJenkins(Downloader):
42+
43+
def setup_class(self):
44+
self.artifact = 'java'
45+
self.branch = 'OMERO-build'
46+
self.ice = '3.6'
47+
48+
@pytest.mark.skipif(True, reason='URL to be updated')
49+
def testDownloadNoUnzip(self, tmpdir):
50+
with tmpdir.as_cwd():
51+
self.download('--skipunzip', '--branch', self.branch,
52+
'--ice', self.ice)
53+
files = tmpdir.listdir()
54+
assert len(files) == 1
55+
56+
@pytest.mark.skipif(True, reason='URL to be updated')
57+
def testDownloadUnzip(self, tmpdir):
58+
with tmpdir.as_cwd():
59+
self.download('--branch', self.branch, '--ice', self.ice)
60+
files = tmpdir.listdir()
61+
assert len(files) == 2
62+
63+
@pytest.mark.skipif(True, reason='URL to be updated')
64+
def testDownloadUnzipDir(self, tmpdir):
65+
with tmpdir.as_cwd():
66+
self.download('--unzipdir', 'OMERO.java', '--branch', self.branch,
67+
'--ice', self.ice)
68+
expected = old_div(tmpdir, 'OMERO.java')
69+
assert expected.exists()
70+
assert expected.isdir()
71+
72+
@pytest.mark.skipif(True, reason='URL to be updated')
73+
def testDownloadSym(self, tmpdir):
74+
with tmpdir.as_cwd():
75+
self.download('--branch', self.branch, '--ice', self.ice,
76+
'--sym', 'auto')
77+
files = tmpdir.listdir()
78+
assert len(files) == 3
79+
80+
expected = old_div(tmpdir, 'OMERO.java')
81+
assert expected.exists()
82+
assert expected.isdir()
83+
84+
# Part two, if an artifact already exists and is unzipped check
85+
# that a new symlink is created if necessary
86+
self.download('--branch', self.branch, '--ice', self.ice,
87+
'--sym', 'custom.sym')
88+
files2 = tmpdir.listdir()
89+
files2diff = set(files2).symmetric_difference(files)
90+
assert len(files2diff) == 1
91+
sym2 = files2diff.pop()
92+
assert sym2 == (old_div(tmpdir, 'custom.sym'))
93+
assert sym2.isdir()
94+
95+
@pytest.mark.skipif(True, reason='URL to be updated')
96+
def testDownloadBuildNumber(self):
97+
# Old Jenkins artifacts are deleted so we can't download.
98+
# Instead assert that an AttributeError is raised.
99+
# This is not ideal since this error could occur for other reasons.
100+
branch = self.branch + ':600'
101+
with pytest.raises(AttributeError) as exc:
102+
self.download('--branch', branch, '--ice', self.ice)
103+
assert 'No artifacts' in exc.value.args[0]
104+
105+
def testDownloadList(self, tmpdir):
106+
self.artifact = ''
107+
self.branch = 'latest'
108+
with tmpdir.as_cwd():
109+
self.download('--branch', self.branch)
110+
files = tmpdir.listdir()
111+
assert len(files) == 0
112+
113+
40114
class TestDownloadRelease(Downloader):
41115

42116
def setup_class(self):
@@ -52,3 +126,19 @@ def testDownloadRelease(self, tmpdir):
52126
def testDownloadNonExistingArtifact(self):
53127
with pytest.raises(AttributeError):
54128
self.download('-n', '--release', '5.3', '--ice', '3.3')
129+
130+
131+
class TestDownloadBioFormats(Downloader):
132+
133+
def setup_class(self):
134+
self.branch = 'BIOFORMATS-build'
135+
136+
@pytest.mark.skipif(True, reason='URL to be updated')
137+
def testDownloadJar(self, tmpdir):
138+
self.artifact = 'formats-api'
139+
with tmpdir.as_cwd():
140+
self.download('--branch', self.branch)
141+
files = tmpdir.listdir()
142+
assert len(files) == 1
143+
assert files[0].basename.endswith(".jar")
144+
assert files[0].basename.startswith('formats-api')

0 commit comments

Comments
 (0)