Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misteryous test failing #776

Closed
Juanlu001 opened this issue Sep 14, 2019 · 8 comments
Closed

Misteryous test failing #776

Juanlu001 opened this issue Sep 14, 2019 · 8 comments
Labels

Comments

@Juanlu001
Copy link
Member

@Juanlu001 Juanlu001 commented Sep 14, 2019

馃悶 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.

@Juanlu001 Juanlu001 added bug support and removed support labels Sep 14, 2019
@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Sep 14, 2019

@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Sep 14, 2019

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.

@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Sep 14, 2019

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.

@Juanlu001 Juanlu001 added upstream and removed bug labels Sep 14, 2019
Juanlu001 added a commit to Juanlu001/poliastro that referenced this issue Sep 14, 2019
@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Sep 14, 2019

...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.

@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Sep 14, 2019

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.

@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Sep 14, 2019

python/mypy#7513

Luckily, there is a workaround.

@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Sep 14, 2019

Fixed in #778.

@Juanlu001 Juanlu001 closed this Sep 14, 2019
@Juanlu001

This comment has been minimized.

Copy link
Member Author

@Juanlu001 Juanlu001 commented Oct 13, 2019

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
Projects
None yet
1 participant
You can鈥檛 perform that action at this time.