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

48

49

from __future__ import absolute_import, division, print_function 

 

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. 

""" 

17 ↛ 20line 17 didn't jump to line 20, because the condition on line 17 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) 

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

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

24 ↛ 25line 24 didn't jump to line 25, because the condition on line 24 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 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() 

 

 

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

lsst.utils.tests.init() 

unittest.main()