rdflib
rdflib copied to clipboard
eliminate warnings from DefinedNamespace which occurs as a consequence of pytest and sphinx
This is maybe not a bug exactly but it is annoying. When building sphinx we get the following warnings:
pytest:
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace DCAT
obj, "_pytestfixturefunction", None
sphinx:
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace DCAT
Not sure what the best strategy is to fix it, one option is to just always raise AttributeError for these attributes, but I'm not sure this is entirely right either, as it seems to be somewhat over fitting/pinning to the problem, there may be a more general solution which is sensible, maybe there is some way to mark the class/metaclass to prevent this.
This is really low priority as it does not break anything, but I thought I would record it anyway just as a mental note.
More details:
https://readthedocs.org/projects/rdflib/builds/16667234/
$ /home/docs/checkouts/readthedocs.org/user_builds/rdflib/envs/1825/bin/python -m sphinx -T -E -W --keep-going -b html -d _build/doctrees -D language=en . _build/html
...(elided)...
The HTML pages are in _build/html.
Updating searchtools for Read the Docs search... /home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace BRICK
partialmethod = obj._partialmethod
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace DCAT
partialmethod = obj._partialmethod
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace PROF
partialmethod = obj._partialmethod
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace SDO
partialmethod = obj._partialmethod
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace SOSA
partialmethod = obj._partialmethod
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace SSN
partialmethod = obj._partialmethod
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace TIME
partialmethod = obj._partialmethod
/home/docs/.asdf/installs/python/3.7.12/lib/python3.7/inspect.py:2250: UserWarning: Code: _partialmethod is not defined in namespace XSD
partialmethod = obj._partialmethod
https://github.com/RDFLib/rdflib/runs/6046502650?check_suite_focus=true
$ /home/runner/work/rdflib/rdflib/.tox/py37-extensive/bin/python -m pytest --cov --cov-report=
...(elided)...
=============================== warnings summary ===============================
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace XSD
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace BRICK
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace DCAT
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace PROF
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace SDO
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace SOSA
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace SSN
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace TIME
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace DFNSDefaults
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace DFNSDefaultsEmpty
obj, "_pytestfixturefunction", None
.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228
/home/runner/work/rdflib/rdflib/.tox/py37-extensive/lib/python3.7/site-packages/_pytest/fixtures.py:228: UserWarning: Code: _pytestfixturefunction is not defined in namespace DFNSWarnNoFail
obj, "_pytestfixturefunction", None
It should be noted that these warnings also occur when running pydoc/help:
$ pipx run --spec git+https://github.com/RDFLib/rdflib.git@master#egg=rdflib python -m pydoc rdflib 2>&1 >/dev/null | head
⚠️ python is already on your PATH and installed at /usr/bin/python.
Downloading and running anyway.
/usr/lib64/python3.10/inspect.py:2426: UserWarning: Code: _partialmethod is not defined in namespace BRICK
partialmethod = obj._partialmethod
/usr/lib64/python3.10/pydoc.py:312: UserWarning: Code: _fields is not defined in namespace BRICK
fields = getattr(object, '_fields', [])
https://brickschema.org/schema/Brick#AED = does not look like a valid URI, trying to serialize this will break.
https://brickschema.org/schema/Brick#AED = rdflib.term.URIRef('https://brickschema.org/schema/Brick#https://brickschema.org/schema/Brick#AED') does not look like a valid URI, trying to serialize this will break.
https://brickschema.org/schema/Brick#AHU = does not look like a valid URI, trying to serialize this will break.
https://brickschema.org/schema/Brick#AHU = rdflib.term.URIRef('https://brickschema.org/schema/Brick#https://brickschema.org/schema/Brick#AHU') does not look like a valid URI, trying to serialize this will break.
- See also https://github.com/RDFLib/rdflib/issues/1972
The _pytestfixturefunction
warning is also raised when running pytest
using the TIME
namespace.
site-packages\_pytest\compat.py:328: UserWarning: Code: _pytestfixturefunction is not defined in namespace DCAT
Also raised there.