Skip to content

mypy attrs tests fail because attrs 18.2.0 was just released #5553

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
euresti opened this issue Sep 1, 2018 · 5 comments · Fixed by #5554
Closed

mypy attrs tests fail because attrs 18.2.0 was just released #5553

euresti opened this issue Sep 1, 2018 · 5 comments · Fixed by #5554

Comments

@euresti
Copy link
Contributor

euresti commented Sep 1, 2018

This morning I tried running the unit tests in a fresh venv with a clean master. All the attrs test failed.
After much looking around I discovered that:
A) The mypy test-requirements.txt installs the attrs package (because it's used by some pytest module)
B) Attrs 18.2.0 "now ships its own PEP 484 type hints. Together with mypy’s attrs plugin, you’ve got all you need for writing statically typed code in both Python 2 and 3!"
C) The mypy tests load the real stubs instead of the ones instead of the ones in lib-stub.

This causes almost every attr test to fail with "Could not find builtin symbol 'dict'. (Are you running a test case? If so, make sure to include a fixture that defines this symbol.)"

I could go into every test and add the correct fixtures but should the tests be loading the real stubs?

cc: @hynek

@ilevkivskyi
Copy link
Member

should the tests be loading the real stubs?

No, this will make tests much slower. We need to find a way to use fixtures in this case (maybe there is a bug in test runner?).

@ilevkivskyi
Copy link
Member

This is actually high priority (assuming your diagnosis is right).

@euresti
Copy link
Contributor Author

euresti commented Sep 1, 2018

The quick workaround is:

diff --git a/test-requirements.txt b/test-requirements.txt
index ba3e1a49..3d946ac4 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,4 +1,4 @@
-attrs>=18.0
+attrs==18.1.0
 flake8
 flake8-bugbear; python_version >= '3.5'
 flake8-pyi; python_version >= '3.6'

@ilevkivskyi
Copy link
Member

Thanks! I am working on a more permanent solution now. I think we can just skip installed stuff if options.use_builtins_fixtures is True. If it will not work, I will just pin the version as you suggest.

@ilevkivskyi
Copy link
Member

Here is what I propose #5554

ilevkivskyi added a commit that referenced this issue Sep 1, 2018
…s set (#5554)

Fixes #5553

The idea is simple, while running tests we should ignore real third-party stub/inline packages and use our own fixtures for everything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants