I have installed pylons based application from egg, so it sits somewhere under /usr/lib/python2.5/site-packages. I see that the tests are packaged too and I would like to run them (to catch a problem that shows up on deployed application but not on development version).
So how do I run them? Doing "nosetests" from directory containing ...
Hello,
So far I've been using the built-in unittest module for unit-testing Python code. However, for simple cases it seems like an overkill. Being a derivative of xUnit, it appears a bit heavy for the dynamic nature of Python, where I would expect to write less to achieve the same effects. On the other hand, it is built-in, makes you w...
This is a follow-up to a previous question of mine.
In the previous question, methods were explored to implement what was essentially the same test over an entire family of functions, ensuring testing did not stop at the first function that failed.
My preferred solution used a metaclass to dynamically insert the tests into a unittest.T...
I'd like to start creating unit tests for my Maya scripts. These scripts must be run inside the Maya environment and rely on the maya.cmds module namespace.
How can I run Nose tests from inside a running environment such as Maya?
...
I use nosetests to run my unittests and it works well. I want to get a list of all the tests nostests finds without actually running them. Is there a way to do that?
...
I'm trying to write a task for Paver that will run nosetests on my files.
My directory structure looks like this:
project/
file1.py
file2.py
file3.py
build/
pavement.py
subproject/
file4.py
test/
file5.py
file6.py
Doctests (using the --with_doctest option) should be run on all the *.py files,...
Can someone show me how to write unit tests for sqlalchemy model I created using nose.
I just need one simple example.
Thanks.
...
My SUT looks like:
foo.py
bar.py
tests/__init__.py [empty]
tests/foo_tests.py
tests/bar_tests.py
tests/integration/__init__.py [empty]
tests/integration/foo_tests.py
tests/integration/bar_tests.py
When I run nosetests --with-coverage, I get details for all sorts of
modules that I'd rather ignore. But I can't use the
--cover-package=P...
I am unable to use nose (nosetests) in a virtualenv project - it can't seem to find the packages installed in the virtualenv environment.
The odd thing is that i can set
test_suite = 'nose.collector'
in setup.py and run the tests just fine as
python setup.py test
but when running nosetests straight, there are all sorts of import e...
Is it possible for the nose unit testing framework to perform tests during the compilation phase of a module?
In fact, I'd like to test something with the following structure:
x = 123
# [x is used here...]
def test_x():
assert (x == 123)
del x # Deleted because I don't want to clutter the module with unnecessary attributes
nosetes...
Hi all
I'm trying to write a simple unit test that will verify that, under a certain condition, a class in my application will log an error via the standard logging API. I can't work out what the cleanest way to test this situation is.
I know that nose already captures logging output through it's logging plugin, but this seems to be i...
I'm getting some integration tests running against the database, and I'd like to have a structure that looks something like this:
class OracleMixin(object):
oracle = True
# ... set up the oracle connection
class SqlServerMixin(object):
sql_server = True
# ... set up the sql server connection
class SomeTests(object):
...
I have a very simple python package that I build into debian packages using setuptools, cdbs and pycentral:
setup.py:
from setuptools import setup
setup(name='PHPSerialize',
version='1.0',
py_modules=['PHPSerialize'],
test_suite = 'nose.collector'
)
debian/rules:
#!/usr/bin/make -f
DEB_PYTHON_SYSTEM = pycentral
include /usr/...
I'm evaluating "test frameworks" for automated system tests; so far I'm looking for a python framework.
In py.test or nose I can't see something like the EXPECT macros I know from google testing framework.
I'd like to make several assertions in one test while not aborting the test at the first failure.
Am I missing something in these fra...
I have a stock Pylons app created using paster create -t pylons with one controller and matched functional test, added using paster controller, and a SQLAlchemy table and mapped ORM class. The SQLAlchemy stuff is defined in the init_model() function rather than in module scope (and needs to be there).
Running python setup.py test raises...
Is there any reason why Nose wouldn't be able to find tests in Ubuntu 9.04? I'm using nose 0.11.1 with python 2.5.4. I can run tests only if I explicitly specify the filename. If I don't specify the filename it just says 0 tests.
The same project runs tests fine on my Mac, so i'm quite stumped.
...
I'm trying to do TDD with PyMock, but I keep getting error when I use Nose and execute core.py from command line:
"ERROR: Failure: ImportError (Settings cannot be imported, because environment variable DJA
NGO_SETTINGS_MODULE is undefined.)"
If I remove "from cms.models import Entry" from the unit test module I created, everything work...
I would like to be able to run a nose test script which accepts command line arguments. For example, something along the lines:
test.py
import nose, sys
def test():
# do something with the command line arguments
print sys.argv
if __name__ == '__main__':
nose.runmodule()
However, whenever I run this with a command line a...
When running nosetests from the command line, how do you specify that 'non-ignored' warnings should be treated as errors?
By default, warnings are printed, but not counted as failures:
[snip]/service/accounts/database.py:151: SADeprecationWarning: Use session.add()
self.session.save(state)
[snip]/service/accounts/database.py:97: SADe...
I'm looking for any way to display the results of python unit tests in an html summary. There are tools like this for Java and Ruby... haven't yet located any tools that seem to do this for Python. Are there any out there?
JUnit html output:
Ruby RSpec output:
...