lsst.obs.base
14.0
Main Page
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
python
lsst
obs
base
tests.py
Go to the documentation of this file.
1
#
2
# LSST Data Management System
3
# Copyright 2016 LSST Corporation.
4
#
5
# This product includes software developed by the
6
# LSST Project (http://www.lsst.org/).
7
#
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the LSST License Statement and
19
# the GNU General Public License along with this program. If not,
20
# see <http://www.lsstcorp.org/LegalNotices/>.
21
#
22
"""
23
Test aggregator for obs_* packages.
24
25
The intention is for each obs package to have a single test class that inherits
26
from this collector class, thus "automatically" getting all new tests. If those
27
tests require setup that isn't defined in a given obs package, that obs package
28
will be broken until updated. This is intentional, as a way to prevent obs
29
packages from falling behind out of neglect.
30
"""
31
32
from
.
import
butler_tests
33
from
.
import
mapper_tests
34
from
.
import
camera_tests
35
36
37
class
ObsTests
(
butler_tests.ButlerGetTests
,
mapper_tests.MapperTests
,
38
camera_tests.CameraTests
):
39
"""
40
Aggregator class for all of the obs_* test classes.
41
42
Inherit from this class, then lsst.utils.tests.TestCase, in that order.
43
44
Example subclass::
45
46
class TestObsExample(lsst.obs.base.tests.ObsTests, lsst.utils.tests.TestCase):
47
def setUp(self):
48
self.setUp_tests(...)
49
self.setUp_butler_get(...)
50
self.setUp_mapper(...)
51
self.setUp_camera(...)
52
"""
53
54
def
setUp_tests
(self, butler, mapper, dataIds):
55
"""
56
Set up the necessary shared variables used by multiple tests.
57
58
Parameters
59
----------
60
butler: lsst.daf.persistence.Butler
61
A butler object, instantiated on the testdata repository for the
62
obs package being tested.
63
mapper: lsst.obs.CameraMapper
64
A CameraMapper object for your camera, instantiated on the testdata
65
repository the obs package being tested.
66
dataIds: dict
67
dictionary of (exposure name): (dataId of that exposure in the
68
testdata repository), with unittest.SkipTest as the value for any
69
exposures you do not have/do not want to test. It must contain a
70
valid 'raw' dataId, in addition to 'bias','flat','dark', which may
71
be set to SkipTest. For example::
72
self.dataIds = {'raw': {'visit': 1, 'filter': 'g'},
73
'bias': {'visit': 1},
74
'flat': {'visit': 1},
75
'dark': unittest.SkipTest
76
}
77
"""
78
self.
butler
= butler
79
self.
mapper
= mapper
80
self.
dataIds
= dataIds
81
82
def
tearDown
(self):
83
del self.
butler
84
del self.
mapper
85
super(ObsTests, self).
tearDown
()
lsst.obs.base.tests.ObsTests
Definition:
tests.py:38
lsst.obs.base.tests.ObsTests.mapper
mapper
Definition:
tests.py:79
lsst.obs.base.camera_tests.CameraTests
Definition:
camera_tests.py:30
lsst.obs.base.tests.ObsTests.setUp_tests
def setUp_tests
Definition:
tests.py:54
lsst.obs.base.tests.ObsTests.dataIds
dataIds
Definition:
tests.py:80
lsst.obs.base.butler_tests.ButlerGetTests
Definition:
butler_tests.py:30
lsst.obs.base.mapper_tests.MapperTests
Definition:
mapper_tests.py:34
lsst.obs.base.tests.ObsTests.tearDown
def tearDown
Definition:
tests.py:82
lsst.obs.base.tests.ObsTests.butler
butler
Definition:
tests.py:78
Generated on Fri Dec 8 2017 20:08:09 for lsst.obs.base by
1.8.5