2020# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2121
2222from __future__ import division
23- from past .utils import old_div
2423from builtins import object
2524import pytest # noqa
2625
@@ -38,74 +37,6 @@ def download(self, *args):
3837 main ("omego" , args = args , items = [("download" , DownloadCommand )])
3938
4039
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- def testDownloadNoUnzip (self , tmpdir ):
49- with tmpdir .as_cwd ():
50- self .download ('--skipunzip' , '--branch' , self .branch ,
51- '--ice' , self .ice )
52- files = tmpdir .listdir ()
53- assert len (files ) == 1
54-
55- def testDownloadUnzip (self , tmpdir ):
56- with tmpdir .as_cwd ():
57- self .download ('--branch' , self .branch , '--ice' , self .ice )
58- files = tmpdir .listdir ()
59- assert len (files ) == 2
60-
61- def testDownloadUnzipDir (self , tmpdir ):
62- with tmpdir .as_cwd ():
63- self .download ('--unzipdir' , 'OMERO.java' , '--branch' , self .branch ,
64- '--ice' , self .ice )
65- expected = old_div (tmpdir , 'OMERO.java' )
66- assert expected .exists ()
67- assert expected .isdir ()
68-
69- def testDownloadSym (self , tmpdir ):
70- with tmpdir .as_cwd ():
71- self .download ('--branch' , self .branch , '--ice' , self .ice ,
72- '--sym' , 'auto' )
73- files = tmpdir .listdir ()
74- assert len (files ) == 3
75-
76- expected = old_div (tmpdir , 'OMERO.java' )
77- assert expected .exists ()
78- assert expected .isdir ()
79-
80- # Part two, if an artifact already exists and is unzipped check
81- # that a new symlink is created if necessary
82- self .download ('--branch' , self .branch , '--ice' , self .ice ,
83- '--sym' , 'custom.sym' )
84- files2 = tmpdir .listdir ()
85- files2diff = set (files2 ).symmetric_difference (files )
86- assert len (files2diff ) == 1
87- sym2 = files2diff .pop ()
88- assert sym2 == (old_div (tmpdir , 'custom.sym' ))
89- assert sym2 .isdir ()
90-
91- def testDownloadBuildNumber (self ):
92- # Old Jenkins artifacts are deleted so we can't download.
93- # Instead assert that an AttributeError is raised.
94- # This is not ideal since this error could occur for other reasons.
95- branch = self .branch + ':600'
96- with pytest .raises (AttributeError ) as exc :
97- self .download ('--branch' , branch , '--ice' , self .ice )
98- assert 'No artifacts' in exc .value .args [0 ]
99-
100- def testDownloadList (self , tmpdir ):
101- self .artifact = ''
102- self .branch = 'latest'
103- with tmpdir .as_cwd ():
104- self .download ('--branch' , self .branch )
105- files = tmpdir .listdir ()
106- assert len (files ) == 0
107-
108-
10940class TestDownloadRelease (Downloader ):
11041
11142 def setup_class (self ):
@@ -121,18 +52,3 @@ def testDownloadRelease(self, tmpdir):
12152 def testDownloadNonExistingArtifact (self ):
12253 with pytest .raises (AttributeError ):
12354 self .download ('-n' , '--release' , '5.3' , '--ice' , '3.3' )
124-
125-
126- class TestDownloadBioFormats (Downloader ):
127-
128- def setup_class (self ):
129- self .branch = 'BIOFORMATS-build'
130-
131- def testDownloadJar (self , tmpdir ):
132- self .artifact = 'formats-api'
133- with tmpdir .as_cwd ():
134- self .download ('--branch' , self .branch )
135- files = tmpdir .listdir ()
136- assert len (files ) == 1
137- assert files [0 ].basename .endswith (".jar" )
138- assert files [0 ].basename .startswith ('formats-api' )
0 commit comments