Coverage for soxspipe/recipes/tests/test_soxs_spatial_solution.py : 92%

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="DEBUG",
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_spatial_solution(unittest.TestCase):
48 def test_soxs_spatial_solution_nir_function(self):
49 sofPath = "~/xshooter-pipeline-data/unittest_data/xsh/xshooter-spat-solution/sof/20170818_NIR_SPAT_SOLUTION.sof"
50 from soxspipe.recipes import soxs_spatial_solution
51 this = soxs_spatial_solution(
52 log=log,
53 settings=settings,
54 inputFrames=sofPath
55 )
56 this.produce_product()
58 def test_soxs_spatial_solution_uvb_function(self):
60 sofPath = "~/xshooter-pipeline-data/unittest_data/xsh/xshooter-spat-solution/sof/20170818_UVB_SPAT_SOLUTION_1x1_fast.sof"
61 from soxspipe.recipes import soxs_spatial_solution
62 this = soxs_spatial_solution(
63 log=log,
64 settings=settings,
65 inputFrames=sofPath
66 )
67 this.produce_product()
69 def test_soxs_spatial_solution_vis_function(self):
70 sofPath = "~/xshooter-pipeline-data/unittest_data/xsh/xshooter-spat-solution/sof/20170818_VIS_SPAT_SOLUTION_1x1_fast.sof"
71 from soxspipe.recipes import soxs_spatial_solution
72 this = soxs_spatial_solution(
73 log=log,
74 settings=settings,
75 inputFrames=sofPath
76 )
77 this.produce_product()
79 # def test_soxs_spatial_solution_function(self):
81 # # utKit.refresh_database() # reset database to database found in
82 # # soxspipe/test/input
83 # from soxspipe.recipes import soxs_spatial_solution
84 # this = soxs_spatial_solution(
85 # log=log,
86 # settings=settings
87 # )
88 # this.get()
90 def test_soxs_spatial_solution_function_exception(self):
92 from soxspipe.recipes import soxs_spatial_solution
93 try:
94 sofPath = "~/xshooter-pipeline-data/unittest_data/xsh/SOMEDIRECTORY/sofs/nir_mixed_exptime_darks.sof"
95 from soxspipe.recipes import soxs_spatial_solution
96 this = soxs_spatial_solution(
97 log=log,
98 settings=settings,
99 inputFrames=sofPath
100 )
101 assert False
102 except Exception as e:
103 assert True
104 print(str(e))
106 # x-print-testpage-for-pessto-marshall-web-object
108 # x-class-to-test-named-worker-function