Package omero :: Package gateway :: Module pytest_fixtures
[hide private]
[frames] | no frames]

Source Code for Module omero.gateway.pytest_fixtures

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3   
 4  """ 
 5     conftest.py - py.test fixtures for gatewaytest 
 6   
 7     Copyright 2013 Glencoe Software, Inc. All rights reserved. 
 8     Use is subject to license terms supplied in LICENSE.txt 
 9   
10  """ 
11  import omero 
12  from omero.rtypes import rstring 
13   
14  from omero.gateway.scripts.testdb_create import * 
15   
16   
17  import pytest 
18 19 -class GatewayWrapper (TestDBHelper):
20 - def __init__ (self):
21 super(GatewayWrapper, self).__init__() 22 self.setUp(skipTestDB=False, skipTestImages=True)
23
24 - def createTestImg_generated (self):
25 ds = self.getTestDataset() 26 assert ds 27 testimg = self.createTestImage(dataset=ds) 28 return testimg
29
30 31 @pytest.fixture(scope='class') 32 -def gatewaywrapper (request):
33 """ 34 Returns a test helper gateway object. 35 """ 36 g = GatewayWrapper() 37 def fin (): 38 g.tearDown() 39 dbhelpers.cleanup()
40 request.addfinalizer(fin) 41 return g 42
43 44 @pytest.fixture(scope='function') 45 -def author_testimg_generated (request, gatewaywrapper):
46 """ 47 logs in as Author and returns the test image, creating it first if needed. 48 """ 49 gatewaywrapper.loginAsAuthor() 50 rv = gatewaywrapper.createTestImg_generated() 51 return rv
52
53 @pytest.fixture(scope='function') 54 -def author_testimg_tiny (request, gatewaywrapper):
55 """ 56 logs in as Author and returns the test image, creating it first if needed. 57 """ 58 gatewaywrapper.loginAsAuthor() 59 rv = gatewaywrapper.getTinyTestImage(autocreate=True) 60 return rv
61
62 @pytest.fixture(scope='function') 63 -def author_testimg_tiny2 (request, gatewaywrapper):
64 """ 65 logs in as Author and returns the test image, creating it first if needed. 66 """ 67 gatewaywrapper.loginAsAuthor() 68 rv = gatewaywrapper.getTinyTestImage2(autocreate=True) 69 return rv
70
71 @pytest.fixture(scope='function') 72 -def author_testimg (request, gatewaywrapper):
73 """ 74 logs in as Author and returns the test image, creating it first if needed. 75 """ 76 gatewaywrapper.loginAsAuthor() 77 rv = gatewaywrapper.getTestImage(autocreate=True) 78 return rv
79
80 @pytest.fixture(scope='function') 81 -def author_testimg_bad (request, gatewaywrapper):
82 """ 83 logs in as Author and returns the test image, creating it first if needed. 84 """ 85 gatewaywrapper.loginAsAuthor() 86 rv = gatewaywrapper.getBadTestImage(autocreate=True) 87 return rv
88
89 @pytest.fixture(scope='function') 90 -def author_testimg_big (request, gatewaywrapper):
91 """ 92 logs in as Author and returns the test image, creating it first if needed. 93 """ 94 gatewaywrapper.loginAsAuthor() 95 rv = gatewaywrapper.getBigTestImage(autocreate=True) 96 return rv
97