-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
write selected LSST Stack package versions and tags to FITS primary h…
…eader for the set up products
- Loading branch information
Showing
4 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
Unit test for get_stack_products function. | ||
""" | ||
import unittest | ||
import subprocess | ||
from desc.imsim import get_stack_products | ||
|
||
|
||
class GetStackProductsTestCase(unittest.TestCase): | ||
""" | ||
TestCase subclass for testing get_stacks_products. | ||
""" | ||
def setUp(self): | ||
pass | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_get_stack_products(self): | ||
"""Test the get_stack_products function.""" | ||
targets = 'lsst_sims throughputs sims_skybrightness_data'.split() | ||
products = get_stack_products(targets) | ||
|
||
for target in targets: | ||
# Test result against eups command line result. | ||
command = f'eups list {target} -s' | ||
line = subprocess.check_output(command, shell=True) | ||
tokens = line.decode('utf-8').strip().split() | ||
version = tokens[0] | ||
tags = set(tokens[1:]) | ||
tags.remove('setup') | ||
|
||
self.assertEqual(products[target].version, version) | ||
self.assertEqual(set(products[target].tags), tags) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |