5.1.3: pytest warnings
kloczek opened this issue · comments
Tomasz Kłoczko commented
Just normal build, install and test cycle used on building package from non-root account:
- "setup.py build":
- "setupy install --root </install/prefix>"
- "pytest with PYTHONPATH pointing to setearch and sitelib inside </install/prefix>
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nbformat-5.1.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nbformat-5.1.3-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ PYTHONDONTWRITEBYTECODE=1
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/nbformat-5.1.3
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, Faker-8.4.0, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0, benchmark-3.4.1
collected 167 items
. . [ 0%]
nbformat/corpus/tests/test_words.py . [ 1%]
nbformat/tests/test_api.py .... [ 3%]
nbformat/tests/test_convert.py .... [ 6%]
nbformat/tests/test_nbformat.py ..... [ 9%]
nbformat/tests/test_reader.py . [ 9%]
nbformat/tests/test_sign.py ................... [ 21%]
nbformat/tests/test_validator.py F.F.F.F.F.F.F.F.F.F...F.F...F.. [ 39%]
nbformat/v1/tests/test_json.py . [ 40%]
nbformat/v1/tests/test_nbbase.py ...... [ 43%]
nbformat/v2/tests/test_json.py ... [ 45%]
nbformat/v2/tests/test_nbbase.py ............. [ 53%]
nbformat/v2/tests/test_nbpy.py . [ 54%]
nbformat/v3/tests/test_json.py ........... [ 60%]
nbformat/v3/tests/test_misc.py . [ 61%]
nbformat/v3/tests/test_nbbase.py ...................... [ 74%]
nbformat/v3/tests/test_nbpy.py ..... [ 77%]
nbformat/v4/tests/test_convert.py ..... [ 80%]
nbformat/v4/tests/test_json.py ............. [ 88%]
nbformat/v4/tests/test_nbbase.py .............. [ 96%]
nbformat/v4/tests/test_validate.py ..... [100%]
================================================================================= FAILURES =================================================================================
_________________________________________________________________________ test_nb2[fastjsonschema] _________________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_nb2(validator_name):
"""Test that a v2 notebook converted to current passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test2.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:37:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:75: in reads
nb = convert(nb, as_version)
nbformat/converter.py:51: in convert
return convert(converted, to_version)
nbformat/converter.py:46: in convert
converted = convert_function(nb)
nbformat/v4/convert.py:45: in upgrade
_warn_if_invalid(nb, from_version)
nbformat/v4/convert.py:22: in _warn_if_invalid
validate(nb, version=version)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 3, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
_________________________________________________________________________ test_nb3[fastjsonschema] _________________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_nb3(validator_name):
"""Test that a v3 notebook passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test3.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:75: in reads
nb = convert(nb, as_version)
nbformat/converter.py:46: in convert
converted = convert_function(nb)
nbformat/v4/convert.py:45: in upgrade
_warn_if_invalid(nb, from_version)
nbformat/v4/convert.py:22: in _warn_if_invalid
validate(nb, version=version)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 3, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
_________________________________________________________________________ test_nb4[fastjsonschema] _________________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_nb4(validator_name):
"""Test that a v4 notebook passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test4.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:77: in reads
validate(nb)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
__________________________________________________________________ test_nb4_document_info[fastjsonschema] __________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_nb4_document_info(validator_name):
"""Test that a notebook with document_info passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test4docinfo.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:67:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:77: in reads
validate(nb)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
______________________________________________________________________ test_nb4custom[fastjsonschema] ______________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_nb4custom(validator_name):
"""Test that a notebook with a custom JSON mimetype passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test4custom.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:77: in reads
validate(nb)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 2, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
_________________________________________________________________ test_nb4jupyter_metadata[fastjsonschema] _________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_nb4jupyter_metadata(validator_name):
"""Test that a notebook with a jupyter metadata passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test4jupyter_metadata.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:77: in reads
validate(nb)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
_____________________________________________________________ test_nb4jupyter_metadata_timings[fastjsonschema] _____________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_nb4jupyter_metadata_timings(validator_name):
"""Tests that a notebook with "timing" in metadata passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test4jupyter_metadata_timings.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:77: in reads
validate(nb)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 4, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
_______________________________________________________________________ test_invalid[fastjsonschema] _______________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_invalid(validator_name):
"""Test than an invalid notebook does not pass validation"""
set_validator(validator_name)
# this notebook has a few different errors:
# - one cell is missing its source
# - invalid cell type
# - invalid output_type
with TestsBase.fopen(u'invalid.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:77: in reads
validate(nb)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
___________________________________________________________________ test_validate_empty[fastjsonschema] ____________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_validate_empty(validator_name):
"""Test that an empty notebook (invalid) fails validation"""
set_validator(validator_name)
with pytest.raises(ValidationError) as e:
> validate({})
nbformat/tests/test_validator.py:122:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 1, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
_______________________________________________________________________ test_future[fastjsonschema] ________________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_future(validator_name):
"""Test that a notebook from the future with extra keys passes validation"""
set_validator(validator_name)
with TestsBase.fopen(u'test4plus.ipynb', u'r') as f:
> nb = read(f, as_version=4)
nbformat/tests/test_validator.py:130:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/__init__.py:143: in read
return reads(buf, as_version, **kwargs)
nbformat/__init__.py:77: in reads
validate(nb)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 99, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
________________________________________________________________ test_iter_validation_empty[fastjsonschema] ________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_iter_validation_empty(validator_name):
"""Test that an empty notebook (invalid) fails validation via iter_validate"""
set_validator(validator_name)
> errors = list(iter_validate({}))
nbformat/tests/test_validator.py:169:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 1, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
________________________________________________________________ test_validation_no_version[fastjsonschema] ________________________________________________________________
validator_name = 'fastjsonschema'
@pytest.mark.parametrize("validator_name", VALIDATORS)
def test_validation_no_version(validator_name):
"""Test that an invalid notebook with no version fails validation"""
set_validator(validator_name)
with pytest.raises(ValidationError) as e:
> validate({'invalid': 'notebook'})
nbformat/tests/test_validator.py:179:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 1, version_minor = 0, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
____________________________________________________________ test_fallback_validator_with_iter_errors_using_ref ____________________________________________________________
def test_fallback_validator_with_iter_errors_using_ref():
"""
Test that when creating a standalone object (code_cell etc)
the default validator is used as fallback.
"""
import nbformat
set_validator("fastjsonschema")
> nbformat.v4.new_code_cell()
nbformat/tests/test_validator.py:208:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nbformat/v4/nbbase.py:126: in new_code_cell
validate(cell, 'code_cell')
nbformat/v4/nbbase.py:39: in validate
return validate(node, ref=ref, version=nbformat)
nbformat/validator.py:268: in validate
for error in iter_validate(nbdict, ref=ref, version=version,
nbformat/validator.py:303: in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
version = 4, version_minor = 5, relax_add_props = False
def get_validator(version=None, version_minor=None, relax_add_props=False):
"""Load the JSON schema into a Validator"""
if version is None:
from . import current_nbformat
version = current_nbformat
v = import_item("nbformat.v%s" % version)
current_minor = getattr(v, 'nbformat_minor', 0)
if version_minor is None:
version_minor = current_minor
current_validator = get_current_validator()
> version_tuple = (current_validator.name, version, version_minor)
E AttributeError: 'NoneType' object has no attribute 'name'
nbformat/validator.py:53: AttributeError
========================================================================= short test summary info ==========================================================================
FAILED nbformat/tests/test_validator.py::test_nb2[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_nb3[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_nb4[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_nb4_document_info[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_nb4custom[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_nb4jupyter_metadata[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_nb4jupyter_metadata_timings[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_invalid[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_validate_empty[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_future[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_iter_validation_empty[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_validation_no_version[fastjsonschema] - AttributeError: 'NoneType' object has no attribute 'name'
FAILED nbformat/tests/test_validator.py::test_fallback_validator_with_iter_errors_using_ref - AttributeError: 'NoneType' object has no attribute 'name'
====================================================================== 13 failed, 153 passed in 9.14s ======================================================================
Tomasz Kłoczko commented
Gentle ping ..
Steven Silvester commented
It looks like you're missing fastjsonschema
, which is listed as one of our test requirementes.
Tomasz Kłoczko commented
Thank you.
After adding to build env fastjsonschema
pytest is eitnishes without errors/fails howwever I see few warnings
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nbformat-5.2.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nbformat-5.2.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/nbformat-5.2.0
collected 176 items
nbformat/corpus/tests/test_words.py . [ 0%]
tests/test_api.py ..... [ 3%]
tests/test_convert.py ..... [ 6%]
tests/test_nbformat.py ..... [ 9%]
tests/test_reader.py ... [ 10%]
tests/test_sign.py ................... [ 21%]
tests/test_validator.py ..................................... [ 42%]
tests/v1/test_json.py . [ 43%]
tests/v1/test_nbbase.py ...... [ 46%]
tests/v2/test_json.py ... [ 48%]
tests/v2/test_nbbase.py ............. [ 55%]
tests/v2/test_nbpy.py . [ 56%]
tests/v3/test_json.py ........... [ 62%]
tests/v3/test_misc.py . [ 63%]
tests/v3/test_nbbase.py ...................... [ 75%]
tests/v3/test_nbpy.py ..... [ 78%]
tests/v4/test_convert.py ...... [ 81%]
tests/v4/test_json.py ............. [ 89%]
tests/v4/test_nbbase.py .............. [ 97%]
tests/v4/test_validate.py ..... [100%]
============================================================================= warnings summary =============================================================================
nbformat/validator.py:355: 16 warnings
tests/test_api.py: 3 warnings
tests/test_validator.py: 19 warnings
tests/v4/test_convert.py: 8 warnings
tests/v4/test_nbbase.py: 16 warnings
tests/v4/test_validate.py: 26 warnings
/home/tkloczko/rpmbuild/BUILD/nbformat-5.2.0/nbformat/validator.py:355: DeprecationWarning: Passing a schema to Validator.iter_errors is deprecated and will be removed in a future release. Call validator.evolve(schema=new_schema).iter_errors(...) instead.
for error in errors:
tests/test_validator.py::test_repair_non_unique_cell_ids
/home/tkloczko/rpmbuild/BUILD/nbformat-5.2.0/nbformat/validator.py:287: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
get_logger().warn("Non-unique cell id '{}' detected. Corrected to '{}'.".format(cell_id, cell['id']))
tests/v3/test_nbbase.py::TestOutputs::test_b64b6tes_jpeg
/home/tkloczko/rpmbuild/BUILD/nbformat-5.2.0/tests/v3/test_nbbase.py:148: UserWarning: A notebook got bytes instead of likely base64 encoded values.The content will likely be corrupted.
out = new_output(output_jpeg=b'/9', output_type='display_data')
tests/v3/test_nbbase.py::TestOutputs::test_b64b6tes_png
/home/tkloczko/rpmbuild/BUILD/nbformat-5.2.0/tests/v3/test_nbbase.py:141: UserWarning: A notebook got bytes instead of likely base64 encoded values.The content will likely be corrupted.
out = new_output(output_png=b'iVBORw0KG', output_type='display_data')
tests/v3/test_nbbase.py::TestOutputs::test_binary_jpeg
/home/tkloczko/rpmbuild/BUILD/nbformat-5.2.0/tests/v3/test_nbbase.py:144: UserWarning: A notebook got bytes instead of likely base64 encoded values.The content will likely be corrupted.
out = new_output(output_jpeg=b'\xff\xd8', output_type='display_data')
tests/v3/test_nbbase.py::TestOutputs::test_binary_png
/home/tkloczko/rpmbuild/BUILD/nbformat-5.2.0/tests/v3/test_nbbase.py:137: UserWarning: A notebook got bytes instead of likely base64 encoded values.The content will likely be corrupted.
out = new_output(output_png=b'\x89PNG\r\n\x1a\n', output_type='display_data')
-- Docs: https://docs.pytest.org/en/stable/warnings.html
===================================================================== 176 passed, 93 warnings in 2.05s =====================================================================
One more time .. thank you 😄
Steven Silvester commented
Thank you, I've updated the title accordingly
Tomasz Kłoczko commented
Looks like is OK now
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nbformat-5.4.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nbformat-5.4.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/nbformat-5.4.0, configfile: pyproject.toml, testpaths: tests/
collected 175 items
tests/test_api.py ..... [ 2%]
tests/test_convert.py ..... [ 5%]
tests/test_nbformat.py ..... [ 8%]
tests/test_reader.py ... [ 10%]
tests/test_sign.py ................... [ 21%]
tests/test_validator.py ..................................... [ 42%]
tests/v1/test_json.py . [ 42%]
tests/v1/test_nbbase.py ...... [ 46%]
tests/v2/test_json.py ... [ 48%]
tests/v2/test_nbbase.py ............. [ 55%]
tests/v2/test_nbpy.py . [ 56%]
tests/v3/test_json.py ........... [ 62%]
tests/v3/test_misc.py . [ 62%]
tests/v3/test_nbbase.py ...................... [ 75%]
tests/v3/test_nbpy.py ..... [ 78%]
tests/v4/test_convert.py ...... [ 81%]
tests/v4/test_json.py ............. [ 89%]
tests/v4/test_nbbase.py .............. [ 97%]
tests/v4/test_validate.py ..... [100%]
=========================================================================== slowest 10 durations ===========================================================================
0.41s call tests/test_sign.py::TestNotary::test_sign_stdin
0.05s call tests/test_validator.py::test_nb2[jsonschema]
0.04s call tests/test_sign.py::TestNotary::test_cull_db
0.04s call tests/test_validator.py::test_future[fastjsonschema]
0.03s call tests/test_validator.py::test_future[jsonschema]
0.03s call tests/test_validator.py::test_invalid_validator_raises_value_error_after_read
0.02s call tests/test_api.py::TestAPI::test_capture_validation_error
0.02s call tests/test_validator.py::test_nb3[jsonschema]
0.02s call tests/test_api.py::TestAPI::test_read
0.02s call tests/test_validator.py::test_nb4jupyter_metadata_timings[fastjsonschema]
=========================================================================== 175 passed in 1.45s ============================================================================
Closing and thank you 😄