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

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. 

""" 

15 ↛ 18line 15 didn't jump to line 18, because the condition on line 15 was never false if rootDir is None: 

rootDir = os.path.dirname(__file__) 

else: 

rootDir = os.path.abspath(rootDir) 

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

20 ↛ 21line 20 didn't jump to line 21, because the condition on line 20 was never true if not os.path.exists(datapath): 

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

22 ↛ 23line 22 didn't jump to line 23, because the condition on line 22 was never true if verbose: 

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

os.environ["ASTROMETRY_NET_DATA_DIR"] = datapath 

return datapath 

 

 

class TestAstrometryNetDataDirDiscovery(unittest.TestCase): 

 

def test_photocal(self): 

datapath = setupAstrometryNetDataDir('t2155') 

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

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

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

pass 

 

 

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

lsst.utils.tests.init() 

unittest.main()