Coverage for soxspipe/recipes/tests/test_soxs_disp_solution.py: 0%

# Coverage for soxspipe/recipes/tests/test_soxs_disp_solution.py : 0%

## 52 statements 0 run 52 missing 0 excluded

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 from __future__ import print_function

2 from builtins import str

3 import os

4 import unittest

5 import shutil

6 import unittest

7 import yaml

8 from soxspipe.utKit import utKit

9 from fundamentals import tools

10 from os.path import expanduser

11 home = expanduser("~")

12

13 packageDirectory = utKit("").get_project_root()

14 settingsFile = packageDirectory + "/test_settings.yaml"

15# settingsFile = home + "/.config/soxspipe/soxspipe.yaml"

16 su = tools(

17 arguments={"settingsFile": settingsFile},

18 docString=__doc__,

19 logLevel="DEBUG",

20 options_first=False,

21 projectName=None,

22 defaultSettingsFile=False

23)

24 arguments, settings, log, dbConn = su.setup()

25

26# SETUP AND TEARDOWN FIXTURE FUNCTIONS FOR THE ENTIRE MODULE

27 moduleDirectory = os.path.dirname(__file__)

28 utKit = utKit(moduleDirectory)

29 log, dbConn, pathToInputDir, pathToOutputDir = utKit.setupModule()

30 utKit.tearDownModule()

31

32 try:

33 shutil.rmtree(pathToOutputDir)

34 except:

35 pass

36# COPY INPUT TO OUTPUT DIR

37 shutil.copytree(pathToInputDir, pathToOutputDir)

38

39# Recursively create missing directories

40 if not os.path.exists(pathToOutputDir):

41 os.makedirs(pathToOutputDir)

42

43

44# xt-setup-unit-testing-files-and-folders

45

46

47 class test_soxs_disp_solution(unittest.TestCase):

48

49 def test_soxs_disp_solution_nir_function(self):

50 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-disp-solution/sof/20170818_NIR_DISP_SOLUTION.sof"

51 from soxspipe.recipes import soxs_disp_solution

52 disp_map_path = soxs_disp_solution(

53 log=log,

54 settings=settings,

55 inputFrames=sofPath

56 ).produce_product()

57 print(f"Here is the final product `{disp_map_path}`")

58

59 def test_soxs_disp_solution_uvb_function(self):

60

61 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-disp-solution/sof/20170818_UVB_DISP_SOLUTION_1x1_fast.sof"

62 from soxspipe.recipes import soxs_disp_solution

63 disp_map_path = soxs_disp_solution(

64 log=log,

65 settings=settings,

66 inputFrames=sofPath

67 ).produce_product()

68 print(f"Here is the final product `{disp_map_path}`")

69

70 def test_soxs_disp_solution_vis_function(self):

71 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-disp-solution/sof/20170818_VIS_DISP_SOLUTION_1x1_fast.sof"

72 from soxspipe.recipes import soxs_disp_solution

73 disp_map_path = soxs_disp_solution(

74 log=log,

75 settings=settings,

76 inputFrames=sofPath

77 ).produce_product()

78 print(f"Here is the final product `{disp_map_path}`")

79

80 # def test_soxs_disp_solution_function(self):

81

82 # # utKit.refresh_database() # reset database to database found in

83 # # soxspipe/test/input

84 # from soxspipe.recipes import soxs_disp_solution

85 # this = soxs_disp_solution(

86 # log=log,

87 # settings=settings

88 # )

89 # this.get()

90

91 def test_soxs_disp_solution_function_exception(self):

92

93 from soxspipe.recipes import soxs_disp_solution

94 try:

95 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-mdark/sofs/nir_mixed_exptime_darks.sof"

96 from soxspipe.recipes import soxs_disp_solution

97 this = soxs_disp_solution(

98 log=log,

99 settings=settings,

100 inputFrames=sofPath

101 )

102 assert False

103 except Exception as e:

104 assert True

105 print(str(e))

106

107 # x-print-testpage-for-pessto-marshall-web-object

108

109 # x-class-to-test-named-worker-function