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

Some pytest fixes #1056

Merged
merged 2 commits into from
Apr 15, 2024
Merged

Some pytest fixes #1056

merged 2 commits into from
Apr 15, 2024

Conversation

jcermauwedu
Copy link

  • base.py: Sometimes cfutil is None
  • protocols/netcdf.py:
    • Return False right away if content_type is None
    • Support extended type strings: "application/x-netcdf;ver=4"
  • suite.py: If text for xml fails, look for netcdf one more time
  • Convert suite.run() calls to suite.run_all() calls
  • Update hyrax url
  • Update thredds url
  • Add some development notes for troubleshooting tests with pytest using the vcr feature.

For the SOS test in test_protocols.py, I set that to skip. I searched for awhile for a working SOS service.

Looking forward to seeing #1039 merged.

 * base.py: Sometimes cfutil is None
 * protocols/netcdf.py:
   - Return False right away if content_type is None
   - Support extended type strings: "application/x-netcdf;ver=4"
 * suite.py: If text for xml fails, look for netcdf one more time
 * Convert suite.run() calls to suite.run_all() calls
 * Update hyrax url
 * Update thredds url
 * Add some development notes for troubleshooting tests with pytest
   using the vcr feature.
@jcermauwedu
Copy link
Author

pre-commit.ci autofix

Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 82.06%. Comparing base (c137e28) to head (b06e777).
Report is 14 commits behind head on develop.

Files Patch % Lines
compliance_checker/base.py 66.66% 0 Missing and 1 partial ⚠️
compliance_checker/suite.py 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1056      +/-   ##
===========================================
- Coverage    82.14%   82.06%   -0.08%     
===========================================
  Files           24       24              
  Lines         5170     5175       +5     
  Branches      1242     1245       +3     
===========================================
  Hits          4247     4247              
- Misses         623      626       +3     
- Partials       300      302       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ocefpaf
Copy link
Member

ocefpaf commented Apr 11, 2024

@jcermauwedu I'm not a compliance-checker expert and I did not look too hard. Can you explain what/when/where cfutil happens to be None? Is that expected or is it an indication of a deeper problem?

@jcermauwedu
Copy link
Author

Without the test for None this is the error. Still digging around for this one...

There are still some pkg references kicking around too.

======================================================================================= test session starts ========================================================================================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/portal/src/compliance-checker
configfile: pyproject.toml
plugins: cov-5.0.0, flake8-1.1.1, requests-mock-1.12.1, vcr-1.0.2, time-machine-2.14.1
collected 235 items                                                                                                                                                                                

compliance_checker/tests/test_acdd.py ................                                                                                                                                       [  6%]
compliance_checker/tests/test_base.py ........                                                                                                                                               [ 10%]
compliance_checker/tests/test_cf.py ...........................................................................................                                                              [ 48%]
compliance_checker/tests/test_cf_integration.py .................                                                                                                                            [ 56%]
compliance_checker/tests/test_cli.py .........                                                                                                                                               [ 60%]
compliance_checker/tests/test_feature_detection.py ...............................                                                                                                           [ 73%]
compliance_checker/tests/test_ioos_profile.py ..........................................                                                                                                     [ 91%]
compliance_checker/tests/test_ioos_sos.py ..                                                                                                                                                 [ 91%]
compliance_checker/tests/test_protocols.py ....s                                                                                                                                             [ 94%]
compliance_checker/tests/test_suite.py .............                                                                                                                                         [ 99%]
compliance_checker/tests/test_util.py .                                                                                                                                                      [100%]

========================================================================================= warnings summary =========================================================================================
compliance_checker/tests/test_cf_integration.py::TestCFIntegration::test_cf_integration[sldmb_43093_agg-expected_messages0]
  /home/portal/src/cc-plugin-ncei/cc_plugin_ncei/util.py:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import resource_filename

compliance_checker/tests/test_cf_integration.py::TestCFIntegration::test_cf_integration[sldmb_43093_agg-expected_messages0]
  /home/portal/miniconda3/envs/py310_dev/lib/python3.10/site-packages/pkg_resources/__init__.py:2832: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================================== 234 passed, 1 skipped, 2 warnings in 24.25s ============================================================================
Exception ignored in: <function BaseCheck.__del__ at 0x702b0dd69fc0>
Traceback (most recent call last):
  File "/home/portal/src/compliance-checker/compliance_checker/base.py", line 198, in __del__
AttributeError: 'NoneType' object has no attribute 'get_geophysical_variables'

@benjwadams benjwadams merged commit 2be8fd4 into ioos:develop Apr 15, 2024
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants