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

Already on GitHub? Sign in to your account

Rename mock attrs in py3 #99

Merged
merged 1 commit into from
Apr 13, 2020
Merged

Rename mock attrs in py3 #99

merged 1 commit into from
Apr 13, 2020

Conversation

mxr
Copy link
Contributor

@mxr mxr commented Sep 13, 2019

Resolves #80

reorder_python_imports.py Outdated Show resolved Hide resolved
reorder_python_imports.py Outdated Show resolved Hide resolved
tests/reorder_python_imports_test.py Outdated Show resolved Hide resolved
reorder_python_imports.py Outdated Show resolved Hide resolved
reorder_python_imports.py Outdated Show resolved Hide resolved
reorder_python_imports.py Outdated Show resolved Hide resolved
reorder_python_imports.py Outdated Show resolved Hide resolved
@rkm
Copy link

rkm commented Jan 28, 2020

Hey folks, I've picked this up and added to @mxr's work here. I believe this resolves a couple of the open comments.

@mxr
Copy link
Contributor Author

mxr commented Apr 12, 2020

@rkm thanks for that!

@asottile I scoped down the change and avoided changing usage output, let me know your thoughts

@mxr mxr requested a review from asottile April 12, 2020 01:40
README.md Outdated Show resolved Hide resolved
@mxr mxr force-pushed the mock-rewrite branch 2 times, most recently from ca0735e to 5873a30 Compare April 12, 2020 01:56
Copy link
Owner

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also handle import mock => from unittest import mock? (or at least add a test demonstrating it works, it might already work!)

I believe there's also some sub-namespaces inside mock that sometimes get auto-populated by greedy IDEs that we could do as well (iirc from mock.mock import Mock?) (don't worry about this for a first pass though -- fine to ignore this suggestion)

README.md Outdated Show resolved Hide resolved
testing/generate-mock-info Outdated Show resolved Hide resolved
testing/generate-mock-info Outdated Show resolved Hide resolved
@mxr
Copy link
Contributor Author

mxr commented Apr 12, 2020

can we also handle import mock => from unittest import mock? (or at least add a test demonstrating it works, it might already work!)

It doesn't already work, looks like the code bails out here. Added an xfailing test in the meantime, not sure how useful that is but it's something 😛

I believe there's also some sub-namespaces inside mock that sometimes get auto-populated by greedy IDEs that we could do as well (iirc from mock.mock import Mock?) (don't worry about this for a first pass though -- fine to ignore this suggestion)

Took a stab at it in this PR. Looks like all the attributes are eligible for this rewrite

@mxr mxr requested a review from asottile April 12, 2020 19:03
@asottile asottile merged commit 6521cae into asottile:master Apr 13, 2020
@mxr mxr deleted the mock-rewrite branch April 14, 2020 00:49
@mxr
Copy link
Contributor Author

mxr commented Apr 14, 2020

🥂 ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--py3-plus cleanup imports
3 participants