Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new tests (load catalog and quantities) #310

Merged
merged 11 commits into from
Jun 6, 2019
Merged

Conversation

yymao
Copy link
Member

@yymao yymao commented May 30, 2019

and also switch to pytest

@yymao yymao requested a review from wmwv May 30, 2019 19:26
@yymao yymao mentioned this pull request May 30, 2019
6 tasks
@yymao yymao added the test Issues related to unit tests and integration tests label May 30, 2019
@yymao yymao force-pushed the u/yymao/new-tests branch from 9dec19b to 58ba6cd Compare May 31, 2019 18:08
@yymao yymao added this to the v0.11.0 milestone May 31, 2019
Copy link
Contributor

@wmwv wmwv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine.

I got two failed tests. If this is expected and the tests are revealing a problem, then adding the tests in the PR remains good.

If there is instead some reason that the test itself is wrong in its expectations, then please fix.

=================================== FAILURES ===================================
______ test_load_catalog_and_quantities[dc2_eimages_run1.2p_visit-181898] ______

catalog = 'dc2_eimages_run1.2p_visit-181898'

    @pytest.mark.parametrize('catalog', all_catalogs)
    def test_load_catalog_and_quantities(catalog):
>       cat = GCRCatalogs.load_catalog(catalog)

tests/test_catalogs.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
GCRCatalogs/register.py:171: in load_catalog
    return load_catalog_from_config_dict(config)
GCRCatalogs/register.py:120: in load_catalog_from_config_dict
    BaseGenericCatalog)(**catalog_config)
/opt/lsst/software/stack/python/miniconda3-4.5.4/envs/lsst-scipipe-fcd27eb/lib/python3.6/site-packages/GCR/base.py:27: in __init__
    self._subclass_init(**kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <GCRCatalogs.eimage.EImageReader object at 0x2aaac852b240>
root_dir = '/global/projecta/projectdirs/lsst/global/DC2/DC2-R1-2p-WFD-r/000008'
visits = 181898, default_rebinning = 16, dirpath_contain = None
filename_pattern = 'lsst_e_(\\d+)(?:_f\\d+)?_(R\\d\\d)_(S\\d\\d)(?:_E\\d+)?(?:_[a-z])?\\.fits\\.gz$'
kwargs = {'description': 'phoSim e-images for Run 1.2p (visit 181898)', 'subclass_name': 'eimage.EImageReader'}

    def _subclass_init(self, root_dir, visits=None, default_rebinning=None,
                       dirpath_contain=None, filename_pattern=_FILENAME_PATTERN,
                       **kwargs):
        # pylint: disable=W0221
        if not os.path.isdir(root_dir):
>           raise ValueError('`root_dir` must be a valid directory')
E           ValueError: `root_dir` must be a valid directory

GCRCatalogs/eimage.py:101: ValueError
______ test_load_catalog_and_quantities[dc2_eimages_run1.2i_visit-181898] ______

catalog = 'dc2_eimages_run1.2i_visit-181898'

    @pytest.mark.parametrize('catalog', all_catalogs)
    def test_load_catalog_and_quantities(catalog):
>       cat = GCRCatalogs.load_catalog(catalog)

tests/test_catalogs.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
GCRCatalogs/register.py:171: in load_catalog
    return load_catalog_from_config_dict(config)
GCRCatalogs/register.py:120: in load_catalog_from_config_dict
    BaseGenericCatalog)(**catalog_config)
/opt/lsst/software/stack/python/miniconda3-4.5.4/envs/lsst-scipipe-fcd27eb/lib/python3.6/site-packages/GCR/base.py:27: in __init__
    self._subclass_init(**kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <GCRCatalogs.eimage.EImageReader object at 0x2aab1f8c46a0>
root_dir = '/global/projecta/projectdirs/lsst/production/DC2_ImSim/DC2-R1-2p-WFD-r'
visits = 181898, default_rebinning = 16, dirpath_contain = '000008_batch'
filename_pattern = 'lsst_e_(\\d+)(?:_f\\d+)?_(R\\d\\d)_(S\\d\\d)(?:_E\\d+)?(?:_[a-z])?\\.fits\\.gz$'
kwargs = {'description': 'ImSim e-images for Run 1.2i (visit 181898)', 'subclass_name': 'eimage.EImageReader'}

    def _subclass_init(self, root_dir, visits=None, default_rebinning=None,
                       dirpath_contain=None, filename_pattern=_FILENAME_PATTERN,
                       **kwargs):
        # pylint: disable=W0221
        if not os.path.isdir(root_dir):
>           raise ValueError('`root_dir` must be a valid directory')
E           ValueError: `root_dir` must be a valid directory

GCRCatalogs/eimage.py:101: ValueError

@@ -1,31 +1,25 @@
from __future__ import unicode_literals, absolute_import, print_function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! We're living in the future!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@yymao
Copy link
Member Author

yymao commented Jun 6, 2019

@wmwv thanks, the errors you saw have been fixed in #318 (and merged to master) but not yet merged to this branch.

I'm going to merge this.

@yymao yymao merged commit 00235a6 into master Jun 6, 2019
@yymao yymao deleted the u/yymao/new-tests branch June 6, 2019 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues related to unit tests and integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants