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

Use unittest.mock on Python 3 #62

Closed
wants to merge 1 commit into from
Closed

Conversation

hroncok
Copy link

@hroncok hroncok commented Jan 12, 2022

In Fedora, we would like to get rid of the separately packaged mock package.

In Fedora, we would like to get rid of the separately packaged mock package.
Copy link
Owner

@mgedmin mgedmin left a comment

Choose a reason for hiding this comment

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

LGTM!

(I'm fine with dropping any Python < 3.6 support at this point, so this could be made simpler and use unittest.mock exclusively.)

@mgedmin
Copy link
Owner

mgedmin commented Jan 12, 2022

Ugh, isort is dumb and doesn't understand that import sections wrapped in try/except are import sections (one blank line of separation) instead of two (which is what I want between the last import section and the beginning of actual code).

Options:

  • fix isort (hard, unrealistic)
  • add the extra blank line isort demands (ugly, acceptable)
  • change isort configuration in setup.cfg (lines_after_imports = 1 instead of 2), but this causes breakage for other Python files
  • drop import mock and always use unittest.mock (probably the best solution, but extra work needed in dropping Python 2.7 first)

Oh hey I see I already dropped Python < 3.6 support for this package, so all the conditional for-python-before-3.3 dependencies are kind of pointless anyway! EDIT: oops I checked the wrong package! But it's past time to drop 2.7 here too.

Let's go with "always use unitttest.mock".

mgedmin added a commit that referenced this pull request Jan 12, 2022
@mgedmin mgedmin mentioned this pull request Jan 12, 2022
@mgedmin
Copy link
Owner

mgedmin commented Jan 12, 2022

extra work needed in dropping Python 2.7 first

and since it would be unfair to pile that work onto you, I've created #63, which, incidentally also drops the mock dependency.

@hroncok
Copy link
Author

hroncok commented Jan 12, 2022

extra work needed in dropping Python 2.7 first

and since it would be unfair to pile that work onto you, I've created #63, which, incidentally also drops the mock dependency.

Thank you for being this nice!

@hroncok hroncok closed this Jan 12, 2022
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.

None yet

2 participants