d0c-s4vage / lookatme

An interactive, terminal-based markdown presenter
https://lookatme.readthedocs.io/en/latest/
MIT License
2.08k stars 61 forks source link

Unit test failures in 2.3.2 #126

Closed reinerh closed 2 years ago

reinerh commented 3 years ago

Describe the bug I'm trying to update the Debian package of lookatme to 2.3.2, but the build fails because of failing unit tests (with 2.3.0 it still succeeds):

I: pybuild base:232: cd /home/reiner/Source/debian/lookatme/lookatme/.pybuild/cpython3_3.9_lookatme/build; python3.9 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
rootdir: /home/reiner/Source/debian/lookatme/lookatme
plugins: cov-2.10.1, mock-1.10.4
collected 31 items

tests/test_cli.py ...                                                    [  9%]
tests/test_contrib.py .                                                  [ 12%]
tests/test_file_loader.py ....                                           [ 25%]
tests/test_markdown.py ...........                                       [ 61%]
tests/test_parse.py .....                                                [ 77%]
tests/test_schemas.py .FF.                                               [ 90%]
tests/test_table.py ...                                                  [100%]

=================================== FAILURES ===================================
__________________ test_sanity_check_that_errors_are_detected __________________

    def test_sanity_check_that_errors_are_detected():
        """Perform a sanity check that we can actually catch errors in generating
        the default schema values.
        """
        schema = MetaSchema()

        # force a discrepancy in the
        gend_default = MetaSchema().dump(None)
        gend_default["styles"]["padding"]["left"] = 100

        with pytest.raises(AssertionError) as excinfo:
>           _validate_field_recursive("__root__.styles", schema.styles.nested(), gend_default['styles'])
E           AttributeError: 'MetaSchema' object has no attribute 'styles'

tests/test_schemas.py:64: AttributeError
_____________________________ test_styles_defaults _____________________________

    def test_styles_defaults():
        """Ensure that style value defaults are generated correctly
        """
        schema = MetaSchema()
        gend_default = MetaSchema().dump(None)
>       _validate_field_recursive("__root__.styles", schema.styles.nested(), gend_default['styles'])
E       AttributeError: 'MetaSchema' object has no attribute 'styles'

tests/test_schemas.py:73: AttributeError
=============================== warnings summary ===============================
/usr/lib/python3/dist-packages/marshmallow/fields.py:173: 72 warnings
  /usr/lib/python3/dist-packages/marshmallow/fields.py:173: RemovedInMarshmallow4Warning: The 'default' argument to fields is deprecated. Use 'dump_default' instead.
    warnings.warn(

/usr/lib/python3/dist-packages/marshmallow/fields.py:181: 16 warnings
  /usr/lib/python3/dist-packages/marshmallow/fields.py:181: RemovedInMarshmallow4Warning: The 'missing' argument to fields is deprecated. Use 'load_default' instead.
    warnings.warn(

/usr/lib/python3/dist-packages/marshmallow/fields.py:218
  /usr/lib/python3/dist-packages/marshmallow/fields.py:218: RemovedInMarshmallow4Warning: Passing field metadata as a keyword arg is deprecated. Use the explicit `metadata=...` argument instead.
    warnings.warn(

.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
.pybuild/cpython3_3.9_lookatme/build/tests/test_schemas.py::test_meta_defaults
  /usr/lib/python3/dist-packages/marshmallow/fields.py:438: RemovedInMarshmallow4Warning: The 'default' attribute of fields is deprecated. Use 'dump_default' instead.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/test_schemas.py::test_sanity_check_that_errors_are_detected - At...
FAILED tests/test_schemas.py::test_styles_defaults - AttributeError: 'MetaSch...
================== 2 failed, 29 passed, 98 warnings in 1.54s ===================
E: pybuild pybuild:353: test: plugin distutils failed with: exit code=1: cd /home/reiner/Source/debian/lookatme/lookatme/.pybuild/cpython3_3.9_lookatme/build; python3.9 -m pytest tests

Expected behavior Unit tests are passing.

Environment (please complete the following information):

AMDmi3 commented 2 years ago

Confirmed the same problem on FreeBSD. Gotta add that marshmallow is 3.15.0 which is within supported range.

d0c-s4vage commented 2 years ago

Taking a look, thank you for reporting this! I'm seeing the same errors locally too.

I've had problems with marshmallow in the past having API breaking changes between minor versions. Seems like this is another one of those.

d0c-s4vage commented 2 years ago

Should be good now, will cut another release later this week after I address some other issues

AMDmi3 commented 1 year ago

Fix confirmed, thank you!

d0c-s4vage commented 1 year ago

Yay! I've been going through tickets and forgot to comment on this one since all of the recent work. Thanks for keeping tabs on it!