Pytest: Make mock only optional dependency

Created on 10 Sep 2018  路  8Comments  路  Source: pytest-dev/pytest

When packaging pytest in Linux distributions (and I guess it matters for other packaging systems as well, e.g., MacPorts or Homebrew), especially for packages which are deep in the tree of dependencies, it is useful to remove all unnecessary dependencies. That's a case of mock, which is since Python 3.3 available in the standard library as unittest.mock.

This patch makes the mock only optional dependency of pytest.

help wanted

All 8 comments

why not just go ahead and make a pr of this

Because I don't want to keep around clones with hundreds of silly Python projects I fix (I am a maintainer of Python for a large Linux distro).

good luck with that

Thanks for the patch, I've created https://github.com/pytest-dev/pytest/pull/3967 (let me know if you want to take credit for it!).

I think it is fair to not having to create PRs: this is usually easy for a contributor that has it checked out already, and it allows to fine-tune e.g. the tox.ini like I did now.

Thanks for PR. Yeah, I don't care that much about attribution, it is not really a great feat of computer engineering after all.

@mcepl
Are you referring to pytest itself?
@RonnyPfannschmidt might agree with you here, but it is still the best testing framework for Python currently, and maybe you might help out more in the future to improve it as a Python maintainer for a distribution.
But from the previous comment also it sounds more like it is your day/paid job only unfortunetatly.

Just a side note: given the specialities with tox etc that showed itself up in the PR I can totally understand that a simple patch is far from getting this finished correctly, and therefore it is very valid to just report issues and provide patches. @RonnyPfannschmidt @nicoddemus (who downvoted the comment)

@mcepl
Are you referring to pytest itself?

No, to my patch. Although I have some gripes with pytest (which are irrelevant here), I believe it is currently the most developed and interesting project in the Python testing arena. Of course, it certainly is a great feat of computer engineering.

Was this page helpful?
0 / 5 - 0 ratings