Skip to content
This repository was archived by the owner on Oct 14, 2023. It is now read-only.
This repository was archived by the owner on Oct 14, 2023. It is now read-only.

Misteryous test failing #776

Closed
Closed

Description

@astrojuanlu

🐞 Problem

One particular test has been bugging us for a while now:

______________ src/poliastro/tests/tests_plotting/test_core.py _______________
142: error: "None" has no attribute "template"

It supposedly comes from here:

def test_dark_theme():
frame = OrbitPlotter3D(dark=True)
assert frame._layout.template.layout.plot_bgcolor == "rgb(17,17,17)"

However, the test doesn't run if any filtering options are applied to pytest, therefore it's a pain in the neck to try to reproduce. I tried:

  • TOXENV=py37 MPLBACKEND=Agg tox -- src/poliastro/tests/tests_plotting/
  • TOXENV=py37 MPLBACKEND=Agg tox -- -k plotting

It started failing overnight, so I suspect it has to do with the MyPy version.

Activity

  1. astrojuanlu commented on Sep 14, 2019

    @astrojuanlu
    MemberAuthor
  2. astrojuanlu commented on Sep 14, 2019

    @astrojuanlu
    MemberAuthor

    Differences in dependencies:

    $ diff -u {ok,bad}_deps2.txt | colordiff
    --- ok_deps2.txt	2019-09-14 13:31:16.377385995 +0200
    +++ bad_deps2.txt	2019-09-14 13:31:25.561352437 +0200
    @@ -38,7 +38,7 @@
     jsonschema==3.0.2
     jupyter-client==5.3.1
     jupyter-core==4.5.0
    -keyring==19.0.2
    +keyring==19.1.0
     kiwisolver==1.1.0
     llvmlite==0.29.0
     MarkupSafe==1.1.1
    @@ -54,7 +54,7 @@
     numba==0.45.1
     numpy==1.17.0
     packaging==19.1
    -pandas==0.25.0
    +pandas==0.25.1
     pandocfilters==1.4.2
     parso==0.5.1
     pexpect==4.7.0
    @@ -70,11 +70,11 @@
     Pygments==2.4.2
     pyparsing==2.4.2
     pyrsistent==0.15.4
    -pytest==5.1.0
    +pytest==5.1.1
     pytest-cov==2.5.1
     pytest-doctestplus==0.3.0
     pytest-mpl==0.10
    -pytest-mypy==0.3.3
    +pytest-mypy==0.4.0
     pytest-remotedata==0.3.2
     python-dateutil==2.8.0
     pytz==2019.2
    @@ -103,8 +103,8 @@
     typed-ast==1.4.0
     typing-extensions==3.7.4
     urllib3==1.25.3
    -virtualenv==16.7.3
    +virtualenv==16.7.4
     w3lib==1.21.0
     wcwidth==0.1.7
     webencodings==0.5.1
    -zipp==0.5.2
    +zipp==0.6.0

    Most likely offender is pytest-mypy.

  3. astrojuanlu commented on Sep 14, 2019

    @astrojuanlu
    MemberAuthor

    I confirm that with pytest-mypy this particular test passes. I will send a PR to pin the version and then try to isolate the failure.

  4. astrojuanlu commented on Sep 14, 2019

    @astrojuanlu
    MemberAuthor

    ...I tried to narrow down the example, and I narrowed it down so much that pytest-mypy 0.3.3 fails with the same error. Which means that perhaps there is some error not being caught by the earlier version because of some code complexity.

  5. astrojuanlu commented on Sep 14, 2019

    @astrojuanlu
    MemberAuthor

    In fact, the issue seems to be that with pytest-mypy 0.3.3, that file gets ignored because of some missing import, but pytest-mypy 0.4 is somehow smarter, runs the check on the file, and realizes that there is something wrong. This is something to investigate on the mypy side.

  6. astrojuanlu commented on Sep 14, 2019

    @astrojuanlu
    MemberAuthor

    python/mypy#7513

    Luckily, there is a workaround.

  7. astrojuanlu commented on Sep 14, 2019

    @astrojuanlu
    MemberAuthor

    Fixed in #778.

  8. astrojuanlu commented on Oct 13, 2019

    @astrojuanlu
    MemberAuthor

    This should be fixed in mypy 0.740 when it's available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions