Skip to content

Commit

Permalink
Remove self-setup from ap_* datasets.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed Feb 5, 2018
1 parent f052f92 commit be261ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion doc/lsst.ap.verify/datasets-creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ The observatory package must be named in two files:
Registering a Dataset Name
--------------------------

In order to be supported by ``ap_verify``, datasets must be registered in the package's :ref:`configuration file<ap-verify-configuration-dataset>`.
In order to be supported by ``ap_verify``, datasets must be registered in the package's :ref:`configuration file<ap-verify-configuration-dataset>` and registered as an *optional* EUPS dependency of ``ap_verify``.
The line for the new dataset should be committed to the ``ap_verify`` Git repository.
19 changes: 13 additions & 6 deletions python/lsst/ap/verify/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

import os
import shutil
from future.utils import raise_from

from eups import Eups

import lsst.pex.exceptions as pexExcept
from lsst.utils import getPackageDir

from .config import Config
Expand Down Expand Up @@ -90,20 +90,27 @@ def __init__(self, datasetId):
except KeyError:
raise ValueError('Unsupported dataset: ' + datasetId)

self._dataRootDir = getPackageDir(datasetPackage)
self._validatePackage()
try:
self._dataRootDir = getPackageDir(datasetPackage)
self._validatePackage()
except pexExcept.NotFoundError as e:
raise_from(
RuntimeError('Dataset %s requires the %s package, which has not been set up.'
% (datasetId, datasetPackage)),
e)

self._initPackage(datasetPackage)

def _initPackage(self, name):
"""Load the package backing this dataset.
"""Prepare the package backing this dataset.
Parameters
----------
name : `str`
The EUPS package identifier for the desired package.
"""
Eups().setup(name)
# No initialization required at present
pass

@staticmethod
def getSupportedDatasets():
Expand Down
7 changes: 0 additions & 7 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ def setUpClass(cls):
def setUp(self):
self._testbed = Dataset(DatasetTestSuite.datasetKey)

# TODO: remove after Datasets no longer perform Eups setup (DM-12853)
def testInit(self):
"""Verify that if a Dataset object exists, the corresponding data are available.
"""
# EUPS does not provide many guarantees about what setting up a package means
self.assertIsNotNone(os.getenv('AP_VERIFY_HITS2015_DIR'))

def testDatasets(self):
"""Verify that a Dataset knows its supported datasets.
"""
Expand Down

0 comments on commit be261ba

Please sign in to comment.