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

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

import fitstools 

import os 

from nose import with_setup 

 

## SETUP AND TEARDOWN FIXTURE FUNCTIONS FOR THE ENTIRE MODULE 

def setUpModule(): 

    "set up test fixtures" 

    moduleDirectory = os.path.dirname(__file__) 

 

    # SETUP THE TEST LOG FILE 

    global testlog 

    testlog = open(moduleDirectory+"/output/tests.log", 'w') 

 

    # SETUP PATHS TO COMMONG DIRECTORIES FOR TEST DATA 

    global pathToInputDataDir, pathToOutputDir, pathToOutputDataDir 

    pathToInputDataDir = moduleDirectory+"/input/data/" 

    pathToOutputDir = moduleDirectory+"/output/" 

    pathToOutputDataDir = pathToOutputDir+"data/" 

    return None 

 

def tearDownModule(): 

    "tear down test fixtures" 

    # CLOSE THE TEST LOG FILE 

    testlog.close() 

    return None 

 

 

## SETUP AND TEARDOWN FIXTURE FUNCTIONS FOR THE ENTIRE MODULE 

def setUpFunc(): 

    "set up the test fixtures" 

 

    global fitsFilePath 

    fitsFilePath =  pathToInputDataDir + "LSQ12dwl_20120808_i705_56462_1_fr.fits" 

    testlog.write(fitsFilePath) 

    return None 

 

def tearDownFunc(): 

    "tear down the test fixtures" 

 

    return None 

 

 

# class TestUM: 

 

#     def setup(self): 

#         print ("TestUM:setup() before each test method") 

 

#     def teardown(self): 

#         print ("TestUM:teardown() after each test method") 

 

#     @classmethod 

#     def setup_class(cls): 

#         print ("setup_class() before any methods in this class") 

 

#     @classmethod 

#     def teardown_class(cls): 

#         print ("teardown_class() after any methods in this class") 

 

#     def test_numbers_5_6(self): 

#         print 'test_numbers_5_6()  <============================ actual test code' 

#         assert 1 + 1 == 2 

 

#     def test_strings_b_2(self): 

#         print 'test_strings_b_2()  <============================ actual test code' 

#         assert 1 + 1 == 2 

 

 

 

@with_setup(setUpFunc, tearDownFunc) 

def test_convert_fits_header_to_dictionary(): 

    "a function to test convert_fits_header_to_dictionary" 

    # testlog.write(fitsFilePath) 

    assert 1 + 1 == 2