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

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

## 56 statements 0 run 56 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="WARNING",

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# xt-setup-unit-testing-files-and-folders

44

45

46 class test_soxs_order_centres(unittest.TestCase):

47

48 def test_soxs_order_centres_nir_function(self):

49 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-order-centres/sof/20170818_NIR_ORDER_CENTRE.sof"

50 # sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-orderpos/nir"

51 from soxspipe.recipes import soxs_order_centres

52 this = soxs_order_centres(

53 log=log,

54 settings=settings,

55 inputFrames=sofPath

56 )

57 this.produce_product()

58

59 def test_soxs_order_centres_uvb_function(self):

60

61 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-order-centres/sof/20170818_UVB_ORDER_CENTRE_DLAMP_1x1_fast.sof"

62 from soxspipe.recipes import soxs_order_centres

63 this = soxs_order_centres(

64 log=log,

65 settings=settings,

66 inputFrames=sofPath

67 )

68 this.produce_product()

69

70 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-order-centres/sof/20170818_UVB_ORDER_CENTRE_QLAMP_1x1_fast.sof"

71 from soxspipe.recipes import soxs_order_centres

72 this = soxs_order_centres(

73 log=log,

74 settings=settings,

75 inputFrames=sofPath

76 )

77 this.produce_product()

78

79 def test_soxs_order_centres_vis_function(self):

80 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-order-centres/sof/20170818_VIS_ORDER_CENTRE_1x1_fast.sof"

81 from soxspipe.recipes import soxs_order_centres

82 this = soxs_order_centres(

83 log=log,

84 settings=settings,

85 inputFrames=sofPath

86 )

87 this.produce_product()

88

89 def test_soxs_order_centres_function_exception(self):

90

91 from soxspipe.recipes import soxs_order_centres

92 try:

93 sofPath = "~/xshooter-pipeline-data/unittest_data/xshooter-orderpos/sof/order_centre_uvb.sof"

94 from soxspipe.recipes import soxs_order_centres

95 this = soxs_order_centres(

96 log=log,

97 settings=settings,

98 inputFrames=sofPath

99 )

100 assert False

101 except Exception as e:

102 assert True

103 print(str(e))

104

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

106

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