Skip to content

Commit

Permalink
replace eups calls with lsst.utils.getPackageDir()
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt committed May 22, 2015
1 parent 3cba4e3 commit a4eb2e7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/Dictionary_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import os
import unittest
import eups
import lsst.utils
#import inspect

import lsst.utils.tests as tests
Expand Down Expand Up @@ -65,8 +65,8 @@ def assertValidationError(self, errorCode, callableObj, field, value):
testDictDir = None
def getTestDictionary(self, filename=None):
if not self.testDictDir:
self.testDictDir = os.path.join(eups.productDir("pex_policy"),
"tests", "dictionary")
pexPolicyDir = lsst.utils.getPackageDir('pex_policy')
self.testDictDir = os.path.join(pexPolicyDir, "tests", "dictionary")
return os.path.join(self.testDictDir, filename) if filename else self.testDictDir

def testDictionaryLoad(self):
Expand Down
10 changes: 6 additions & 4 deletions tests/UrnPolicyFile_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import os
import unittest
import eups
import lsst.utils
#import inspect

import lsst.utils.tests as tests
Expand Down Expand Up @@ -61,8 +61,9 @@ def assertRaiseLCE(self, excClass, excMsg, callableObj, failMsg, *args, **kwargs
examplesDir = None
def getExamples(self, filename=None):
if not self.examplesDir:
self.examplesDir = os.path.join(eups.productDir("pex_policy"),
"examples")
# XXX is this really the best way to find the src_dir?
pexPolicyDir = lsst.utils.getPackageDir('pex_policy')
self.examplesDir = os.path.join(pexPolicyDir, "examples")
if filename:
return os.path.join(self.examplesDir, filename)
else:
Expand Down Expand Up @@ -133,7 +134,8 @@ def testRepos(self):
# when the repository is mis-specified, local files cannot be loaded
upf = UrnPolicyFile("pex_policy:tests:urn/indirect_parent_good.paf")
# we expect it to look in <package>/tests/simple.paf
expectedFile = os.environ["PEX_POLICY_DIR"] + "/tests/simple.paf"
pexPolicyDir = lsst.utils.getPackageDir('pex_policy')
expectedFile = pexPolicyDir + "/tests/simple.paf"
self.assertRaiseLCE(lsst.pex.exceptions.IoError,
"failure opening Policy file: " + expectedFile,
upf.load, "Wrong repository dir.", Policy())
Expand Down
3 changes: 2 additions & 1 deletion tests/testBigBool.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
import unittest
import time

import lsst.utils
from lsst.pex.policy import Policy

proddir = os.environ["PEX_POLICY_DIR"]
proddir = lsst.utils.getPackageDir('pex_policy')

class BigBoolTestCase(unittest.TestCase):

Expand Down
3 changes: 2 additions & 1 deletion tests/testGet.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
import unittest
import time

import lsst.utils
from lsst.pex.policy import Policy

proddir = os.environ["PEX_POLICY_DIR"]
proddir = lsst.utils.getPackageDir('pex_policy')

class GetTestCase(unittest.TestCase):

Expand Down
1 change: 1 addition & 0 deletions ups/pex_policy.table
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
setupRequired(daf_base)
setupRequired(utils)

envPrepend(LD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)
envPrepend(DYLD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)
Expand Down

0 comments on commit a4eb2e7

Please sign in to comment.