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

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
1from __future__ import print_function
2from builtins import str
3import os
4import unittest
5import shutil
6import unittest
7import yaml
8from soxspipe.utKit import utKit
9from fundamentals import tools
10from os.path import expanduser
11home = expanduser("~")
13packageDirectory = utKit("").get_project_root()
14settingsFile = packageDirectory + "/test_settings.yaml"
15# settingsFile = home + "/.config/soxspipe/soxspipe.yaml"
16su = tools(
17 arguments={"settingsFile": settingsFile},
18 docString=__doc__,
19 logLevel="WARNING",
20 options_first=False,
21 projectName=None,
22 defaultSettingsFile=False
23)
24arguments, settings, log, dbConn = su.setup()
26# SETUP AND TEARDOWN FIXTURE FUNCTIONS FOR THE ENTIRE MODULE
27moduleDirectory = os.path.dirname(__file__)
28utKit = utKit(moduleDirectory)
29log, dbConn, pathToInputDir, pathToOutputDir = utKit.setupModule()
30utKit.tearDownModule()
32try:
33 shutil.rmtree(pathToOutputDir)
34except:
35 pass
36# COPY INPUT TO OUTPUT DIR
37shutil.copytree(pathToInputDir, pathToOutputDir)
39# Recursively create missing directories
40if not os.path.exists(pathToOutputDir):
41 os.makedirs(pathToOutputDir)
43# xt-setup-unit-testing-files-and-folders
46class test_soxs_order_centres(unittest.TestCase):
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()
59 def test_soxs_order_centres_uvb_function(self):
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()
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()
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()
89 def test_soxs_order_centres_function_exception(self):
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))
105 # x-print-testpage-for-pessto-marshall-web-object
107 # x-class-to-test-named-worker-function