As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What is your single favorite mocking library for Python?
I've only used one, but I've had good results with Michael Foord's Mock: http://www.voidspace.org.uk/python/mock/.
Michael's introduction says it better than I could:
There are already several Python mocking libraries available, so why another one?
Most mocking libraries follow the 'record -> replay' pattern of mocking. I prefer the 'action -> assertion' pattern, which is more readable and intuitive particularly when working with the Python unittest module.
...
It also provides utility functions / objects to assist with testing, particularly monkey patching.
Mox, from Google
Mocker from Gustavo Niemeyer.
It's not perfect, but it is very powerful and flexible.
Dingus, by Gary Bernhardt.
I'm the author for mocktest. I think it's pretty fully featured and easy to use, but I might be biased:
http://gfxmonk.net/dist/doc/mocktest/doc/
pyDoubles the test doubles framework for Python, by iExpertos.com. It supports mocks, stubs, spies and matchers, including Hamcrest matchers
I've used pMock in the past, and didn't mind it, it had pretty decent docs too. However, Foord's Mock as mentioned above is also nice.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm looking for a way to make two Python scripts communicate over the internet. Something like what Socket.IO does with NodeJS, but without a browser, and in Python.
A constant connection (socket?) would be the best in my option, but if this is impossible or really difficult, using normal HTTP requests could be fine too.
Are there any frameworks to do this? If yes, which ones? Is there proper documentation? If no, how would this be achievable without a framework?
sockets are indeed what you're looking for. The Python docs have pretty good examples at the bottom of the page I linked.
As for frameworks, there is twisted which might help streamline the socket construction and message handling for you.
Lastly, there is an extremely helpful guide I reference often when programming with sockets. Warning: The guide is written for C, but the concepts apply nonetheless.
You should try to do this with xmlrpclib : http://docs.python.org/2/library/xmlrpclib.html.
It handle HTTP request.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Perl has the strict and warnings pragmas and a couple of CPAN modules for encouraging good style and reducing errors. Is there a Python counterpart that can help me avoid such problems and bad practices while it encourages me to use a more Pythonic structure?
I should make it clear that I do not know what I want to avoid. There is probably a lot of traps to fall into, and I'm not looking for a substitute to reading good code, reading about common errors and writing a lot, but for a complementing automated resource.
I believe pylint (http://www.logilab.org/857) is the most most common tool used for this purpose.
The classic style guide for Python is PEP8. If you are interested in style errors, a checker for PEP8 can be found at http://pypi.python.org/pypi/pep8.
googling for Python lint yielded this: http://pychecker.sourceforge.net/
Don't forget the -t option to the python interpreter for tab warnings and if you're currently using 2.x and want to minimize the trauma of switching to 3.x in the future, the -3 option will help.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I am evaluating options for a scripting language to embed at my company.
We mostly make indie games, and we use managed frameworks (Unity and XNA). This means that we need a solution that works with both Mono and .Net, and we'd rather avoid stuff that is too slow.
The possibilities we are considering are the following:
python
lua
F#
The features we require are:
continuations/coroutines
decent performance
integration with Mono and .Net (compatible type systems)
[optional]. ease of extensibility to add new combinators such as multithreaded coroutines
[optional]. easy bindings
I know for certain that I can achieve all requirements in F# with a custom-built monad (I have several working prototypes which are ending in a few products) but I would gladly jump to another solution if it is proven to be better!
As you're using .net anyway, any of the .net languages might allow you the easiest implementations. From a learning perspective etc. I'd prefer Lua any time due to it's rather simple basic constructs and syntax rules.
I have a weird-er suggestion for you. How about using C# or VB.NET?
You can dynamically compile scripts and save the assemblies. This way you get minimum loading time.
You can also register them in the GAC and have no worry!
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am looking for good End to End testing framework under python, where the tests can be written in python and managed in a comfortable way. I know there are many unit testing frameworks, but I am looking for bigger scope, something like test director with support for reports etc,where a whole system is under test.
You havent given any details so it is very difficult to know what specific product are you looking for.
Maybe robotframework suits your needs
I used zope.testing and it was very good for my need, but it's not so different from simple unittest.
There is a good comparative here. I guess most of the products cited are more of the unit testing kind. Not sure you will find what you look for.
The TTCN3 is a quite good test framework for black-box testing. The comercial tools are having lot of reporting stuff there. It is not in python.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Do you know of well designed open source applications that are instructive to analyse?
Of course this question is strictly related to this other post, but I am specifically interested in applications written in Python.
Django is a python package that is very nicely coded and designed.
Look in the Python Standard Library. It is a great wealth of python code. I particularly like this.py :)
Seriously though there is good code in the std library.
Zope .
Pyramid is Great !
Pyramid - Web Framework