linkml / linkml-runtime

Runtime support for linkml generated models
https://linkml.io/linkml/
Creative Commons Zero v1.0 Universal
24 stars 23 forks source link

Fix get_classes_modifying_slot #254

Closed amc-corey-cox closed 1 year ago

amc-corey-cox commented 1 year ago

Use slot name to check for classes modifying slot.

amc-corey-cox commented 1 year ago

I almost have this... just need to fix one more thing.

amc-corey-cox commented 1 year ago

I updated the poetry.lock file (to what main was using) and fixed the get_classes_modifying_slot function now. I'm still getting a test failure on my system and we have this failure here. I may need a little help tracking this down; I think we're failing in a file I didn't touch.

amc-corey-cox commented 1 year ago

When I do poetry run pytest in my local linkml-runtime repository, I receive the following error. I get the error whether running a newly pulled main or my current branch:

============================================= test session starts ==============================================
platform linux -- Python 3.10.6, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/corey/Repositories/linkml-runtime
collected 130 items / 1 error

==================================================== ERRORS ====================================================
______________________ ERROR collecting tests/test_processing/test_referencevalidator.py _______________________
ImportError while importing test module '/home/corey/Repositories/linkml-runtime/tests/test_processing/test_referencevalidator.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_processing/test_referencevalidator.py:14: in <module>
    from examples import PermissibleValue
E   ImportError: cannot import name 'PermissibleValue' from 'examples' (/home/corey/.cache/pypoetry/virtualenvs/linkml-runtime-13gtrlfc-py3.10/lib/python3.10/site-packages/examples/__init__.py)
=============================================== warnings summary ===============================================
tests/support/test_environment.py:35
  /home/corey/Repositories/linkml-runtime/tests/support/test_environment.py:35: PytestCollectionWarning: cannot collect test class 'TestEnvironment' because it has a __init__ constructor (from: tests/support/test_environment.py)
    class TestEnvironment:

../../.cache/pypoetry/virtualenvs/linkml-runtime-13gtrlfc-py3.10/lib/python3.10/site-packages/_pytest/compat.py:330
  /home/corey/.cache/pypoetry/virtualenvs/linkml-runtime-13gtrlfc-py3.10/lib/python3.10/site-packages/_pytest/compat.py:330: UserWarning: Code: _pytestfixturefunction is not defined in namespace XSD
    return getattr(object, name, default)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================== short test summary info ============================================
ERROR tests/test_processing/test_referencevalidator.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================= 2 warnings, 1 error in 0.32s =========================================

I don't think this is complaining about anything that I touched but I'm not sure how to solve this. Separately, we're seeing a crash of the windows-latest test environment and I'm not clear why it is failing. I tried a rebase on linkml-runtime main and it says I'm up-to-date. Let me know what you think.

cmungall commented 1 year ago

@pkalita-lbl @dalito any ideas?

pkalita-lbl commented 1 year ago

I tried just checking out the repo and doing a poetry install on my Windows test VM. But I'm not able to reproduce the error that's happening on the Windows action runners. This issue seems to imply it's a Poetry 1.4.0 issue, although I have Poetry 1.4.0 on my VM and, again, no issue there. I'll try reading that issue more closely tomorrow and see if it offers anything useful to try.

codecov-commenter commented 1 year ago

Codecov Report

Merging #254 (862e760) into main (b992fe0) will increase coverage by 0.37%. The diff coverage is 62.58%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
+ Coverage   63.54%   63.91%   +0.37%     
==========================================
  Files          53       53              
  Lines        6117     6236     +119     
  Branches     1650     1692      +42     
==========================================
+ Hits         3887     3986      +99     
+ Misses       1774     1769       -5     
- Partials      456      481      +25     
Impacted Files Coverage Δ
linkml_runtime/index/object_index.py 88.28% <12.50%> (-3.53%) :arrow_down:
linkml_runtime/dumpers/rdflib_dumper.py 94.94% <40.00%> (-2.97%) :arrow_down:
linkml_runtime/utils/context_utils.py 68.33% <50.00%> (-1.85%) :arrow_down:
linkml_runtime/utils/schemaview.py 83.29% <55.67%> (-3.11%) :arrow_down:
linkml_runtime/__init__.py 100.00% <100.00%> (ø)
linkml_runtime/utils/namespaces.py 73.37% <100.00%> (+2.48%) :arrow_up:
linkml_runtime/utils/yamlutils.py 79.44% <100.00%> (+1.29%) :arrow_up:

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

pkalita-lbl commented 1 year ago

I've pinned the Poetry version to 1.3.2 in the test workflow and that seems to have resolved the Windows test failures. I think it's not a bad practice in general to pin versions of anything used in a build/test/publish workflows in order to make it as reproducible as possible. But we should keep an eye on that issue to see when we might be able to bump the pinned version up to 1.4.x.