Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

import os 

import unittest 

 

import lsst.utils.tests 

 

 

def setupAstrometryNetDataDir(name, rootDir=None, verbose=False): 

"""Locate the named Astrometry.net data directory from within 

the current tree, relative to this file, or relative to the supplied 

root directory. 

 

Returns the located data directory and sets the ASTROMETRY_NET_DATA_DIR 

environment variable. 

""" 

if rootDir is None: 

rootDir = os.path.dirname(__file__) 

else: 

rootDir = os.path.abspath(rootDir) 

datapath = os.path.join(rootDir, 'astrometry_net_data', name) 

if not os.path.exists(datapath): 

raise ValueError("Need {} version of astrometry_net_data (from path: {})".format(name, datapath)) 

if verbose: 

print('Setting up astrometry_net_data: {}'.format(datapath)) 

os.environ["ASTROMETRY_NET_DATA_DIR"] = datapath 

return datapath 

 

 

class TestAstrometryNetDataDirDiscovery(unittest.TestCase): 

 

def setUp(self): 

self.datapath = setupAstrometryNetDataDir('photocal') 

 

def test_photocal(self): 

self.assertEqual(os.environ["ASTROMETRY_NET_DATA_DIR"], self.datapath) 

 

 

class MemoryTester(lsst.utils.tests.MemoryTestCase): 

pass 

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

45 ↛ 46line 45 didn't jump to line 46, because the condition on line 45 was never trueif __name__ == "__main__": 

lsst.utils.tests.init() 

unittest.main()