{6} All Tickets By Milestone (Including closed) (121 matches)

A more complex example to show how to make advanced reports.

1.0

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#90 Improve logging config options nose new None enhancement normal jpellerin

Logging (for nose itself and the packages it tests) config should be more accessible -- esp. it should be possible to configure logging with a standard logging config file. Attachment is a plugin from Oliver Rutherfurd that adds --log-config and --log-filename options. This should be adapted and made part of configure_logging in nose.core.

09/13/06
#85 Is it possible to have more control over TestProgram configuration when running the nose from within python code? nose assigned None 0.9 enhancement normal jpellerin

I am trying to use nose with the NoseXML plugin. When I call:

nose.run(argv=['--with-nosexml','--xml-report-file=some_file']),

I get my NoseXML output in some_file. This is nice.

On the other hand, it would be nicer if I could specify a StringIO that the NoseXML could write to instead of a file in the filesystem.

I have managed to do this by poking around inside the nose.core.TestProgram? class and nose.core.configure function, but my solution is not really acceptable for long-term use. I manually insert a StringIO into the configuration information after argv is parsed and before it is passed to the plugins.

Please consider providing a different means for specifying configuration information to nose when it is run using nose.run(). I would be glad to help with this if it would be an acceptable change.

And if I've missed the proper way to do something like this, please let me know.

Thanks, Matthew Desmarais

08/28/06
#57 .noserc nose assigned None 1.0 normal normal jpellerin

Support reading options from a .noserc file or other config file. Format should be the same as command line args (long form), minus the --.

05/14/06
#80 provide TestCase methods as functions. nose closed worksforme 0.9 enhancement normal jpellerin

Hi

First of all I'm new to nose and I like what I see, I always complained about JUnit/pyUnit because it's too much troubles ... nose takes that away from me.

but when I try to test for a method that should raises a certain type of exception I found out that the only way to do this is with TestCase, at least to catch a certain specific type of test.

So how abotu adding a reimplementation (basically transform the methods into functions of TestCase.* into module level nose functions?

So we can implement this

class TestMyApp(TestCase):
    def test_create(self):
        self.failUnlessRaises(NotImplementedError, source.create)

as

def test_create():
    nose.failUnlessRaises(NotImplementedError, source.create)

here is the original thread. http://tinyurl.com/mvssg

08/04/06
#24 Allow plugins to completely change test output nose:plugins closed fixed 1.0 normal normal jpellerin

Currently watcher plugins can report() to add to test output, but there should be a hook for plugins to take over and do all test output.

03/27/06

0.9rc1

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#27 Missing units nose closed fixed 0.9a1 major high jpellerin

Missing unittests for many core functions:

06/22/06

0.9b1

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#61 Attribute plugin 'OR' test doesn't work nose:plugins closed fixed 0.9a1 normal normal jpellerin

nosetests -a tags=a -a tags=b should select tests that have a tags attribute with the value of 'a' or 'b' or a list containing one or both of those values, but it doesn't.

05/24/06
#59 nose.tools.raises hides module of original test nose closed fixed 0.9a1 minor normal jpellerin

When using nose.tools.raises, the test reports look like:

nose.tools.<testfunc>

Instead of:

<testmod>.<testfunc>

raises needs to set the name or module of the wrapper it returns properly.

05/24/06
#58 ArrtibuteError running nosetests nose:importer closed fixed 0.9a1 normal high jpellerin

I'm getting this when running nosetests. Not sure whats causing it, but I thought someone might be able to point me in the right direction.

I will attach the traceback.

05/24/06

0.9a2

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#54 ignore all executable files? nose closed fixed 0.9 normal normal jpellerin
  • Is this desirable? (YES)
  • Is it possible to do, dependably, cross-platform? (YES)
05/08/06
#51 nose.collector causes loop when running `setup.py test` nose closed invalid 0.9a1 normal normal jpellerin

have a looksee here at my setup.py file: svn co http://svn.testtools.python-hosting.com/trunk --revision=186 testtools

I'm using test_suite = "nose.collector" and when I run `setup.py test` with 0.9a1 it gets caught in a loop like so :

running test running egg_info writing testtools.egg-info/PKG-INFO writing top-level names to testtools.egg-info/top_level.txt writing manifest file 'testtools.egg-info/SOURCES.txt' running build_ext At revision 186. running test running egg_info writing testtools.egg-info/PKG-INFO writing top-level names to testtools.egg-info/top_level.txt writing manifest file 'testtools.egg-info/SOURCES.txt' running build_ext At revision 186.

... but when I run `nosetests` everything goes smooth. I mentioned in the email that it was working on dev2, but I meant it was working for other projects. I.E. running `python setup.py test` in etl/trunk/py-lib/ works just fine. I can't see offhand what is different.

05/08/06
#53 plugin import errors kill test run nose:plugins closed fixed 0.9 major normal jpellerin

Plugin import errors need to be reduced to warnings, since the import happens before users have a chance to disable the plugin.

Example: If profile module is not installed, nosetests exits with exception without running any tests.

05/08/06
#52 profile plugin shadows builtin profile module nose:plugin:profile closed fixed 0.9a1 major normal jpellerin

It needs a name change, causes nosetests to fail to load on some platforms.

05/08/06
#56 wantFunction and wantMethod bugs in attr [patch] nose:plugins closed fixed 0.9 normal normal jpellerin

this might be better fixed in the loader since I think at least for the wantMethod bug, it should not get something that's not a method. But this patches was necessary to allow a large ETL suite to run that I'm trying to use attributes in. a patch against branches/0.9-stable is to follow

05/06/06
#55 bug in doctest plugin loadTestsFromPath [patch] nose:plugin:doctest closed fixed 0.9a1 normal normal jpellerin

we get an iteration error in the doctest plugin when looking at a directory filename (i.e. not a valid .py file). A patch is to follow ...

05/04/06

0.9a1

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#50 Update mkrelease nose closed fixed 0.9 normal high jpellerin

Update mkrelease to make svn/svk branch and tag instead of bzr.

04/30/06
#4 doc -> wiki nose closed fixed 0.9a1 normal low jpellerin

Add a script similiar to mkindex.py that posts doc updates to the right places in this wiki.

04/26/06
#49 Update docs for 0.9 nose closed fixed 0.9 normal highest jpellerin
  • Update the CHANGELOG and NEWS files.
  • Update module, package and class docstrings
  • Update TestProgram? usage
  • Update mkindex, make sure it is pulling all relevant info
  • Update hacking, etc, on index to include new svn repos information
  • Add to this ticket as I think of more doc updates that are needed
04/26/06
#37 setuptools integration phase 2: disable plugins nose:plugins closed fixed 0.9 normal normal jpellerin

When run under setuptools, should disable plugins that implement methods that won't get a chance to run (report, finalize, prepareTest, setOutputStream).

04/24/06
#48 logging behavior: ignore root logger settings nose closed fixed 0.9 normal normal jpellerin

Since nose is likely to be run in unstable environments where users are setting their root or other loggers to debug to debug their own code, and those users are probably not interested in nose's debug info, nose should explicitly override the root logger settings in the 'nose' domain. Don't use basicConfig, but compose a handler and formatter and set the log level to whatever is appropriate for the selected verbosity level.

04/23/06
#46 super? nose closed fixed 0.9 normal normal jpellerin

Check usage of super() vs direct init calls. Ref: http://fuhm.net/super-harmful/

04/23/06
#44 disable attrib plugin eval option for versions < 2.4 nose:plugins closed fixed 0.9 normal normal jpellerin

eval() can't take an instance in 2.3, so the attrib eval() option must be disabled in 2.3.

04/23/06
#45 Fix tests for 2.3 nose:selftest closed fixed 0.9 normal normal jpellerin

Many tests are failing under 2.3 due to incompatibile iteration, etc.

04/19/06
#43 nosetests bad_file.py -> greedy loads nose closed fixed 0.9 normal normal jpellerin

When given a bad file name, nosetests loads tests from all modules instead of issuing a warning.

04/16/06
#42 nosetests relative/path.py -> no tests loaded nose closed fixed 0.9 normal normal jpellerin

Test name resolution for relative filenames is wrong. The files are not loaded.

04/16/06
#41 profiler plugin is broken nose:plugin:profile closed fixed 0.9 normal normal jpellerin

Trying to run with profiler enabled results in errors from the hotshot stats loader:

Could not identify fileId 10
Could not identify fileId 10
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/hotshot/stats.py", line 12, in load
    return StatsLoader(filename).load()
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/hotshot/stats.py", line 29, in load
    for event in log:
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/hotshot/log.py", line 120, in next
    filename = self._filemap[fileno]
KeyError: 91
04/16/06
#40 stop on first error nose closed fixed 0.9a1 normal normal jpellerin

Suggestion from Kevin Dangoor:

Add an option to stop running tests on the first failure.

04/16/06
#36 loader.loadTestsFromNames behavior nose closed fixed 0.9 normal normal jpellerin

The test loader's loadTestsFromNames behavior isn't compatible with single-test-file unittest-style command lines, eg:

python unit_tests/test_loader.py TestNoseTestLoader.test_generate_func

It needs to be revised for compatibility with unittest.

04/16/06
#34 nose.main signature does not match unittest.main nose closed fixed 0.9 normal normal jpellerin

nose.main should be usable interchangably with unittest.main.

04/16/06
#33 coverage plugin: option to erase before run nose:plugin:coverage closed fixed 0.9 normal normal jpellerin

The coverage plugin should have an option to allow the user to erase accumulated stats before a test run.

04/12/06
#32 revise setuptools support, phase 1 nose closed fixed 0.9 normal normal jpellerin

To support setuptools test command as best as possible without monkeypatching, follow PJE's prescription:

   class ResultProxy:
        def addError(self, test, err):
            # reformat err, adding captured info
            # then calling addError() on the wrapped result

        def startTest(self, test):
            # code to begin output capture and assertion tracking
            # then call startTest() on the wrapped result

        def stopTest(self, test):
            # code to end output capture and assertion tracking
            # then call stopTest() on the wrapped result

        # ... etc.


    class TestProxy:
        def __call__(self, result):
            self.wrapped_test(ResultProxy(result))

        def shortDescription(self):
            return self.wrapped_test.shortDescription()

The test_suite hook is still better than the test_loader hook, since test suite can be a function that does other setup; it should configure the system with a setting that deactivates any plugins that can't be supported under this scenario (that is, any plugin that uses report, finalize, prepareTest or setOutputStream)

04/10/06
#31 nose.tools nose closed fixed 0.9 normal normal jpellerin

Create nose.tools module and move with_setup there. Also add:

  • @raises
  • @timed

And try to think of some more useful, general test-writing tools to add.

04/10/06
#14 test generators for methods do not work nose closed fixed 0.8.7.1 normal normal jpellerin

Given the following testclass:

class TestSomething(object):

def setUp(cls):

cls.x = 5 print "setting up"

def test_1(self):

assert self.x == 4

def test_2(self):

assert self.x == 6

def test_3(self):

for x in (1,2,7):

yield self.check,x

def check(self,arg):

assert arg %7 ==0

Method test_3 does not function as a proper test generator. What should probably happen is:

1) test_3 generates three separate tests, just like regular test generators 2) Each of the three tests created by test_3 should get setUp() called when they're called.

04/10/06
#25 profiler: output controls nose:plugin:profile closed fixed 0.9 normal normal jpellerin

Need controls and options for those controls for the profiler plugin. Including:

  • formatting options -- sort, restrict func names, % of list
  • prof data filename option (file to store profile data in during run)
  • print/no print report
  • print to report stream
  • output to file
04/06/06
#10 document plugin interfaces nose:plugins closed fixed 0.9a1 normal high jpellerin

Document the collector, selector and watcher methods that plugins can implement and where they are called in the process.

04/06/06
#22 loading tests from classes: beware subclassing nose closed fixed 0.9 normal normal jpellerin

The following case will currently result in wrong behavior:


class TestA:
    def test_a(self):
        pass

class TestB(TestA):
    def test_b(self):
        pass

TestB will collect and run both test_a and test_b; it should only run test_a

04/02/06
#8 warn on missed test names nose closed fixed 0.9a1 normal normal jpellerin

When called with test names on the command line, eg:

nosetests foo.bar.test

nose should track what tests it finds and runs, and warn at the end if a specified test name was not found. Not sure where to do the tracking.

04/02/06
#30 pass captured output to plugins nose:result closed fixed 0.9a1 normal high jpellerin

In addError and addFailure, pass captured output (if any) to plugin calls.

03/29/06
#29 _import failure nose:importer closed fixed 0.9a1 blocker highest jpellerin

This import shouldn't be failing in selftest:

======================================================================
ERROR: test module stpackage.subpak.other.tests in /Users/jhp/projects/nose_work_0.9/st
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jhp/projects/nose_work_0.9/nose/suite.py", line 35, in run
    self.setUp()
  File "/Users/jhp/projects/nose_work_0.9/nose/suite.py", line 128, in setUp
    self.module = _import(self.moduleName, [self.path], self.conf)
  File "/Users/jhp/projects/nose_work_0.9/nose/importer.py", line 63, in _import    fh, filename, desc = find_module(part, path)
ImportError: No module named tests
03/29/06
#19 watcher plugin API: access to test results nose:plugins closed fixed 0.9a1 normal normal jpellerin

make it easier for watcher plugins to access test results... possibly call addError, etc, in plugins from TextTestResult?.

03/27/06
#16 unit tests for plugin option handling nose closed fixed 0.9a1 normal normal jpellerin

See #15 for an example of why these are needed. All builtin plugins and builtin options/config need unit tests to ensure that they function as advertised

03/27/06
#26 func_names -> funcNames nose closed fixed 0.9a1 minor normal jpellerin

Much as I hate camelCase, unittest uses it and some overridden methods must use it, so for consistency, everythingShouldLookLikeThis.

03/26/06
#23 refactor: revise for better unittest compatibility nose closed fixed 1.0 normal highest jpellerin

Refactor implemenation for a better fit with the slots provided.

Ideas:

Add more details to this ticket.

03/26/06
#18 setUpModule doesn't work nose closed fixed 0.8.7.1 normal normal jpellerin

In the documentation, it says you can use 'setUpModule' as the setup function for a module. In the code though, it actually uses 'setupModule' (note the different case on the 'u')

03/23/06
#2 implement profiler plugin nose:plugin:profile closed fixed 0.9a1 normal normal jpellerin

Plugin should be a Watcher that outputs a profiler report after test run. Possibly exclude test packages from report, have a --profile-package argument (like coverage plugin).

03/23/06
#17 improve library discovery nose:selector closed fixed 0.9a1 normal high jpellerin

nosetests deals badly with a common package layout:

pack
  lib
    foo.py
  test
    test_foo.py

To be friendlier to that layout, selector should be updated to want directories that look like common source directories (lib and src at least).

03/23/06
#5 'EOF in multiline input' nose:assert closed fixed 0.9a1 normal high jpellerin

Assert introspection fails for many expressions with an error like 'EOF in multiline input'

03/19/06
#15 attrib plugin env defaults should not be strings nose:plugins closed fixed 0.9a1 major high jpellerin

The attrib plugin is currently broken because the option defaults are strings, but the option type is append.

03/19/06
#9 use logging for messaging nose closed fixed 0.9a1 normal normal jpellerin

This will be a 2-step process:

  1. replace nose.util.msg() with real logging, using the builting logging module.
  2. provide an interface for selecting which loggers and levels to output and where
03/15/06
#7 add option to activate pdb on error/fail nose closed fixed 0.9a1 normal normal jpellerin

Add command line option/env var to activate the pdb on error/fail feature.

03/15/06
#6 patch AssertionError only nose closed invalid 0.9a1 normal high jpellerin

Install the patch that introspects assets as AssertionError? only, instead of patching builtin.Exception.

03/14/06
#12 patch: attribute-based test case selector nose closed fixed 0.9a1 normal normal jpellerin

This patch adds selecting test cases based on their attributes.

Examples of test function/method attribute usage with patched nose

Simple syntax (-a, --attr) examples:

  • nosetests -a status=stable => only test cases with attribute "status" having value "stable"
  • nosetests -a priority=2,status=stable => both attributes must match
  • nosetests -a tags=http => attribute list "tags" must contain value "http" (see test_foobar() below for definition)
  • nosetests -a slow => attribute "slow" must be defined and its value cannot equal to False (False, [], "", etc...)
  • nosetests -a !slow => attribute "slow" must NOT be defined or its value must be equal to False

Eval expression syntax (-A, --eval-attr) examples:

  • nosetests -A "not slow"
  • nosetests -A "(priority > 5) and not slow"

This example and the accompanied patch is in public domain, free for any use.

03/14/06
#11 patch: Windows path handling issues nose closed fixed 0.9a1 normal normal jpellerin

Nose 0.9 r5 fails to run any test cases on Windows. Here's a patch with fixes to some path handling issues.

- Mika

03/12/06
#3 use clean config in units nose:selftest closed fixed 0.9a1 normal high jpellerin

In the unittests in selftest, each class or instance that can take a config argument should get a fresh _Config(), so that the configuration of the driving test runner doesn't leak into the test cases.

03/11/06

0.9.2

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#113 python setup.py nosetests --stop was raise TypeError nose assigned None 0.9 normal normal jpellerin

I'm not sure if this would be true across all extra options sent to setup.py nosetests, however the fix seemed simple enough (the internals needed to handle integer values). A rough patch is following (this got it working).

All this, using nose revision 143 and setuptools 0.6c3

12/13/06
#110 isolation plugin nose:plugins assigned None enhancement normal jpellerin

Include a plugin in core that resets the state of sys.modules between after each test module is run.

12/02/06
#109 doctest vs coverage nose:plugin:doctest assigned None normal normal jpellerin

doctest requires a patch (or monkeypatch) to work correctly with the coverage module.

ref:

http://www.nedbatchelder.com/code/modules/coverage.html

http://svn.zope.org/Zope3/trunk/src/zope/testing/doctest.py?rev=28679&r1=28703&r2=28705

Since nose can't patch a user's doctest directly, we'll have to monkeypatch in a revise _OutputRedirectingPdb?.

12/01/06
#108 Generate and post plugin docs nose:plugins assigned None normal normal jpellerin

Generate HTML docs for built-in plugins and post them to the site and wiki.

11/22/06
#106 Revise long description in setup.py nose assigned None normal normal jpellerin

Revise the long description in setup.py to be more accurate and descriptive.

11/21/06
#100 nosetests man page nose assigned None enhancement normal jpellerin

Install a man page for nosetests on install. A man page contributed by Gustavo Noronha Silva is attached to this ticket.

10/28/06
#112 test can't be run from package directory -- misleading INFO message nose assigned None normal low jpellerin

I have a small module, i.e. a dir (say, package/) which has an init.py, a foo.py and a test_foo.py test_foo.py has the line 'import foo' in it, as it contains the test code for the code in foo.py

I try to run the tests by running 'nosetests -vv' in the dir. I see the line "nose.core: INFO: Working directory is a package; adding to sys.path" appear, but the tests won't run, I get an ImportError?: No module named foo

The problem is that the message "Working directory is a package; adding to sys.path" is misleading. I doesn't add the current directory, it adds the _parent_ of the current directory to sys.path. (Due to the way add_path() is implemented in sys.path)

I'm not sure how to characterise this problem. Simply having 'import package.foo' instead of 'import foo' in test_foo.py makes it work. Is there any reason to prohibit using 'import foo' in this case? Or maybe using add_path() for adding the current working directory is a bug?

12/13/06
#102 Nose frontpage installation instructions in error nose assigned None 0.9.1 minor low jpellerin

These instructions are wrong:

Install nose using setuptools:

easy_install nose

Or, if you don't have setuptools installed, use the download link 
at right to download the source package, and install in the normal
fashion: Ungzip and untar the source package, cd to the new
directory, and:

python setup.py install

You cannot run python setup.py install without setup_tools upgraded to at least the version that nose is configured to work with, as per this error message:

$ sudo python setup.py install                                                ~/src/nose-0.9.1
The required version of setuptools (>=0.6c2) is not available, and
can't be installed while this script is running. Please install
 a more recent version first.

(Currently using setuptools 0.6c1 (/usr/lib/python2.4/site-packages/setuptools-0.6c1-py2.4.egg))
zsh: 32149 exit 2     sudo python setup.py install

I recommend ammending the instructions to say

python ez_setup.py
python setup.py install

and note that the installation will cause easy_install to be installed. Perhaps a link to ez_setup.py would be good too.

11/07/06
#95 evaluating asserts stops working when there is a two-line docstring nose closed fixed 0.9 normal normal jpellerin

This is a problem with nose version 0.9.0.

When I run the following test with nosetests -d option,

def test_integers():

a = 2 assert a == 4

I get this expected result, the variable a is expanded:

...

assert a == 4 AssertionError? 2 = 2 >> assert 2 == 4

However, when I add a two-line docstring like that:

def test_integers():

"""docstring line 1 docstring line 2 """ a = 2 assert a == 4

then, instead of the variable expansion, the last line of the docstring is displayed:

...

assert a == 4 AssertionError? docstring line 2

12/06/06
#101 Doesn't select decorated methods/functions nose:selector closed invalid 0.9 normal normal jpellerin

If a function has a decoration nose will not pick it up for testing, it is of type 'function proxy' instead of 'function'.

This was tested on Debian testing with version 0.9.0-1

Test case:

def my_decor(func):
        return lambda: func()

def test_decor():
        assert False

@my_decor
def test_decor1():
        assert False

In the above test case we have two functions, one decorated and one not. Running it through nosetests shows only one detected function which fails while we expect two functions failing.

Running it in verbose mode will show that test_decor1 is not picked up for testing.

12/05/06
#111 nosetests -vvvv produces little output nose closed fixed minor normal jpellerin

You get more output with -v, -vv, and -vvv -- but with -vvvv the output goes away

12/05/06
#105 nose 0.9.1 does not run functional tests in order of appearance in the module nose:collector closed fixed 0.9.1 normal normal jpellerin

In nose main page, http://somethingaboutorange.com/mrl/projects/nose/, the section titled **Writing tests** says:

[quote]

Like py.test, functional tests will be run in the order in which they appear in the module file. TestCase derived tests and other test classes are run in alphabetical order.

[endquote]

nose 0.9.1 does not seem to do this at all. It seems that it performs the tests in the following order:

- run test functions that are defined with the raises decorator - runs the other test functions in alphabetical order of the test function names

py.test does run the test functions in order of appearance in the module and I'd like to be able to depend on that when using nose.

12/05/06
#79 ability to change the regex pattern nose closed fixed 0.9 enhancement normal jpellerin

hello, i just started using nose and i've read the help but can't find a setting to customize the discovery regex. was hoping it would discover tests named with our standard naming system: something like 'modulename_unittest.py'. could this functionality be added?

12/05/06
#107 Expose the guts of @raises as assert_raises nose closed fixed enhancement normal jpellerin

@raises is useful for some users, but others want to be able to stack up several raises tests inside of one test case, so it would be helpful to have an assert_raises that they can call directly.

12/05/06
#39 setuptools integration: pick up options from setup.cfg nose closed fixed 0.9 normal normal jpellerin

Suggestion from Kevin Dangoor:

Even if hooking into setuptools' test command doesn't work,
would it be possible for you to make a distutils command wrapper
(setuptools allows you to easily plug in new commands). The reason I
say this is that nosetests has a growing set of options, and it would
be nice to be able to specify the right set of options in setup.cfg.

First need to figure out what this will require and from that decide the appropriate milestone.

11/18/06
#38 setuptools integration phase 3: custom command nose closed fixed 0.9 normal normal jpellerin

Create a setuptools command that exposes the full functionality of nose and all plugins.

11/18/06
#99 integrated twisted with nose nose closed fixed enhancement normal jpellerin

Here is the Twisted integration source code.

twistedtools.py is the implementation itself (I first tried to call it "twisted", but then it shadows the original twisted package). It allows to decorate tests that return a Deferred.

test_twisted.py is the test suite for the implementation. There probably should be a way to skip it if Twisted is not installed (instead of raising ImportError? all around), but I don't know the right way to do that.

11/12/06
#92 @with_setup doesn't mix well with @raises nose closed fixed 0.9 major normal jpellerin

Hi,

I tried to write the following code:

@raises(NotEnoughBytes?) @with_setup(setup1) def test32():

...

This failed in a strange way. It seems nose either called the wrong setup function (I have different setup functions for different tests), or didn't call one at all (I didn't investigate very far). The fix came by inverting the decorator order:

@with_setup(setup1) @raises(NotEnoughBytes?) def test32():

...

11/12/06

0.9.1

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#98 @with_setup not calling teardown() if test raises exception nose closed worksforme 0.9.1 normal normal jpellerin

I'm not sure if this is desired behvior or not, but I noticed that if a test function decorated with @with_setup() raises an exception then the teardown() method is not called. My personal choice is that a teardown function is called in a finally block as the test is run, to *always* undo what was done by setup.

I took a [very] quick stab at adding a test to nose's suite for this but couldn't come up with one since setup and teardown are just properties set on the test method. hmm. Was using revision 98.

-Kumar McMillan?

10/22/06
#94 --doctest-extension and NOSE_DOCTEST_EXTENSION conflict nose closed fixed 0.9 normal normal jpellerin

If you define both the environmental variable and give the command-line variable, you get:

Traceback (most recent call last):
  File "/usr/local/bin/nosetests", line 7, in ?
    sys.exit(
  File "/usr/local/lib/python2.4/site-packages/nose-0.9.0-py2.4.egg/nose/core.py", line 438, in main
    return sys.exit(not run(*arg, **kw))
  File "/usr/local/lib/python2.4/site-packages/nose-0.9.0-py2.4.egg/nose/core.py", line 446, in run
    result = TestProgram(*arg, **kw).success
  File "/usr/local/lib/python2.4/site-packages/nose-0.9.0-py2.4.egg/nose/core.py", line 199, in __init__
    self.parseArgs(argv, env)
  File "/usr/local/lib/python2.4/site-packages/nose-0.9.0-py2.4.egg/nose/core.py", line 206, in parseArgs
    self.conf = configure(argv, env)
  File "/usr/local/lib/python2.4/site-packages/nose-0.9.0-py2.4.egg/nose/core.py", line 322, in configure
    options, args = parser.parse_args(argv)
  File "/usr/lib/python2.4/optparse.py", line 1278, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.4/optparse.py", line 1318, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.4/optparse.py", line 1393, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python2.4/optparse.py", line 710, in process
    return self.take_action(
  File "/usr/lib/python2.4/optparse.py", line 723, in take_action
    values.ensure_value(dest, []).append(value)
AttributeError: 'str' object has no attribute 'append'
10/10/06
#93 try:except: around inspect.getargspec nose closed fixed normal normal jpellerin

I got this exception from the collector:

  File "/usr/local/lib/python2.4/site-packages/nose-0.9.0-py2.4.egg/nose/util.py", line 163, in try_run
    args, varargs, varkw, defaults = inspect.getargspec(func)
  File "/usr/lib/python2.4/inspect.py", line 670, in getargspec
    raise TypeError('arg is not a Python function')

nose should catch this and tell more about what "func" really is.

10/10/06
#96 Names of modules in test packages nose closed worksforme minor normal jpellerin

Test packages are not documented very well. It seems all modules living in a test package are automatically considered test modules, irrespective whether their names match the testMatch regular expression or not. Is this by design? At least it should be documented.

10/10/06
#91 python 2.5: assert introspection: different line counts nose:assert closed fixed 0.9.1 minor normal jpellerin

In python 2.5, some assert introspection tests fail because the traceback source analyzer comes back with different line numbers sometimes than it does in 2.4.

09/19/06
#76 No handlers for logger spam nose closed fixed 0.9.1 minor normal jpellerin

No handlers could be found for logger "nose.plugins" is spammed to the console sometimes(?) on startup.

09/06/06
#86 python version detection broken for 3.0 and above nose:plugins closed fixed 0.9.1 minor normal jpellerin

From Kevin Dangoor:

in nose/plugins/attrib.py:

compat_24 = pyvrs[0] >= 2 and pyvrs[1] >= 4

would fail with Python 3.0 (though all bets are off for compatibility
there anyhow :)

Python version detection actually had a discussion on the tg list a
few months back.

you can rewrite this:
compat_24 = sys.version_info >= (2, 4)
09/06/06
#81 /lib -style package organization broken nose closed fixed 0.9.1 normal normal jpellerin

When a package is organized like:

 /lib
    module.py
 /tests
    test_module.py

nose loads test_module but even though it has already seen lib, it has failed to put it on sys.path, unless a plugin has asked to load all modules.

Possible solution: when addPaths is on, always add the surrounding directory of any .py file we see.

08/24/06
#83 -x/--stop stops on skipped tests nose closed fixed 0.9 normal normal jpellerin

the -x/--stop option will stop on a skipped test even though that's not really an error. I haven't tested the others like deprecated tests. Tested w/ version 0.9.0 only.

08/24/06
#75 Multiple --include arguments should 'OR' not override nose:selector closed fixed 0.9.1 normal normal jpellerin

Multiple --include arguments should result in everything that matches any of them being included, instead of the current behavior, which is that only the last --include issued is used.

08/23/06
#78 option for coverage to include all .py files nose closed fixed 0.9 enhancement normal jpellerin

Coverage reported by the coverage plugin can be misleading. Files not imported by the test suite will not be reported, thereby making the coverage appear larger. This patch adds a --cover-inclusive option that will cause all .py files (matching --cover-package if existing) under the working directory to be included in the report.

08/08/06
#72 package.mod:Class doesn't select all tests in class nose:selector closed fixed 0.9 normal high jpellerin

It looks like package.mod:Class is broken; it doesn't select all of the tests in the class -- it selects nothing.

07/28/06
#74 Possible bug in subpackage_of nose:selector closed fixed 0.9 normal normal jpellerin

I was using 0.9b2 earlier without problems, but after upgrade to 0.9 "python setup.py test" command doesn't work anymore. My directory structure is (full avaiable here: http://pycheesecake.org/browser/branches/mk):

cheesecake/
...
README
setup.py
tests/
    unit/
    functional/
    data/

Running "nosetests --with-doctest --doctest-tests --include unit --verbose" runs all of the tests in "tests/unit" along with doctests found in package code. But using nose.collector by setup.py script runs only one doctest from the "tests/unit/" directory (so it omits all unit tests and doctests in project directory "cheesecake/"). Our setup.py config is avaiable here: http://pycheesecake.org/browser/branches/mk/setup.py .

By browsing through the diff of 0.9b->0.9.0 I've found out that part of code that makes a difference is inside new subpackage_of() function. If you omit comparisons of "mod_parts" and "pkg_parts" (lines 369-379) nose.collector works just like in 0.9b running all of my unit and doc tests.

07/21/06
#60 Add function that works like unittest.main(): collects tests in __main__ only nose closed fixed 0.9.1 normal normal jpellerin

Add a function to core that works like unittest.main, that is, collects test in main only. Usage would be like:

import nose

def test_a():
    pass

def test_b():
    pass

if __name__ == '__main__':
    nose.runtests()
07/12/06
#62 Allow multiple -w arguments nose closed fixed 0.9.1 normal normal jpellerin

nosetests should allow multiple -w arguments to include multiple test roots in one run.

07/12/06
#73 nose.collector not finding all tests in `setup.py test` nose closed fixed 0.9 critical highest jpellerin

using nose-0.9.0-py2.4.egg ... I'm getting some strange behavior trying to run `python setup.py test` It only finds my doctests. However, if I run `nosetests -v --with-doctest --doctest-tests` all tests are found. In setup.py I am setting the env vars which would be the equivalent of the above command line options, i.e.

os.environ['NOSE_WITH_DOCTEST'] = '1'
os.environ['NOSE_DOCTEST_TESTS'] = '1'

I will dig around the code a little more to see if I can figure out where it's going wrong, but wanted to submit this ticket in the meantime since you might know where to look in nose.collector

here is how to reproduce :

svn co --revision 197 http://svn.testtools.python-hosting.com/trunk testtools
cd testtools
python setup.py test

and this is what I was expecting :

nosetests -v --with-doctest --doctest-tests

am I missing anything?

07/12/06

0.9

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#71 nosetests -s results in IOError: [Errno 29] Illegal seek nose closed worksforme 0.9 normal normal jpellerin

I do:

$ nosetests -s

and get:

Traceback (most recent call last):
  File "/usr/bin/nosetests", line 7, in ?
    sys.exit(
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/core.py", line 434, in main
    return sys.exit(not run(*arg, **kw))
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/core.py", line 442, in run
    result = TestProgram(*arg, **kw).success
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/core.py", line 201, in __init__
    self.runTests()
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/core.py", line 229, in runTests
    result = self.testRunner.run(self.test)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/core.py", line 100, in run
    result = unittest.TextTestRunner.run(self, test)
  File "/usr/lib/python2.4/unittest.py", line 696, in run
    test(result)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 40, in __call__
    self.run(*arg, **kw)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 54, in run
    test(result)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 40, in __call__
    self.run(*arg, **kw)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 54, in run
    test(result)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 40, in __call__
    self.run(*arg, **kw)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 54, in run
    test(result)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 40, in __call__
    self.run(*arg, **kw)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 54, in run
    test(result)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 40, in __call__
    self.run(*arg, **kw)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/suite.py", line 54, in run
    test(result)
  File "/usr/lib/python2.4/unittest.py", line 281, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.4/unittest.py", line 276, in run
    if ok: result.addSuccess(self)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/result.py", line 176, in addSuccess
    Result.addSuccess(self, test)
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/result.py", line 83, in addSuccess
    self.resetBuffer()
  File "/usr/lib/python2.4/site-packages/nose-0.9.1.dev_r63-py2.4.egg/nose/result.py", line 104, in resetBuffer
    sys.stdout.truncate(0)
IOError: [Errno 29] Illegal seek

using nose patch 68 from SVN under Ubuntu Dapper (6.06).

Not sure why the egg is labeled dev_r63, but it's definiately patch 68.

07/01/06
#70 Missing file warning spam nose:selector closed fixed 0.9 normal normal jpellerin

The missing file warning repeats once for every test file compared against a requested missing file. It would be better to output only once per run per missing file.

06/30/06
#69 All python files are executable on windows nose closed fixed 0.9 normal normal jpellerin

On Windows (or at least my version of Windows XP) all newly created .py files are executable. That is, os.access(myFilePath, os.X_OK) returns True for all of my .py files.

This means that the default behaviour of omitting executable files unless --exe is set causes doctests in non-test modules to not run on Windows. This happens because non-test modules get checked with wantFile() rather than wantModule() and get ignored becuase there are executable.

This bug is hidden slightly at the moment because the sense of --exe is currently reversed - see #68. Currently the doctests are omitted when --exe is used. After #68 is fixed they will be omitted when --exe is not used.

06/30/06
#21 add unittests for lunatic objects nose:selector closed fixed 0.9 normal normal jpellerin

Add unittests for weirdo calls that might come up, such as calling want_function() with something that doesn't have a __name__.

06/22/06
#1 coverage output for single tests nose:plugin:coverage closed fixed 0.9 normal normal jpellerin

Ran:

python nose/core.py -vvvvv -w st/unit_tests --with-coverage --cover-package=nose test_selector

Expected: coverage output

Actual: no coverage output

06/21/06
#68 The meaning of '--exe' is backwards nose:selector closed fixed 0.9 normal normal jpellerin

the command line option '--exe' is documented as causing more files to be included. Therefore it should increase the number of tests run. In my tests adding this option actually decreases the number of tests run.

C:\data\code\aa\Newman\POS\gui>python "c:\Program Files\Python23\Scripts\nosetes
ts-script.py" -d --with-doctest --doctest-tests -v
doctest of DialogExceptHook.DialogExceptHook ... ok

----------------------------------------------------------------------
Ran 1 test in 0.359s

OK

C:\data\code\aa\Newman\POS\gui>python "c:\Program Files\Python23\Scripts\nosetes
ts-script.py" -d --with-doctest --doctest-tests -v --exe

----------------------------------------------------------------------
Ran 0 tests in 0.015s

OK

I think I've tracked this down to the following code starting on line 241 of source:branches/0.9-stable/nose/selector.py#40

if not self.conf.ignoreExe and os.access(file, os.X_OK):
    log.info('%s is executable; skipped', file)
    return False

that 'not' looks like it should not be there.

06/21/06
#66 specifying test names causes repeat imports nose:importer closed fixed major high jpellerin

Specifying test names can change nose's behavior in extremely strange ways. For The attached test case, the following all produce different import behavior, in some cases resulting in repeat imports of modules in sys.modules:

nosetests -w zz
nosetests
nosetests test_model
nosetests -w zz test_model
06/21/06
#63 TypeError: iteration over non-sequence nose:plugin:doctest closed fixed 0.9 blocker normal jpellerin

This exception is thrown when running:

nosetests --with-doctest .

And it's thrown by trying to iterate over the result of DocTest?.py::loadTestsFromPath(), which returns None.

My expectation (although I've only read the code diagonally), is for loadTestsFromModule() to find my doctests, and loadTestsFromPath() to be used for loading doctests from other places. I really haven't understood the purpose of loadTestsFromPath(), have I?

I'll attach a patch right away, but I'm afraid I'm only masking the error somehow; please do look it over to see if that is what's correct.

06/21/06
#35 profiler: output to stream or file nose:plugin:profile closed fixed 0.9 normal normal jpellerin

The profiler plugin should be able to output to the results stream or a selected file.

04/16/06
#28 Missing units nose closed duplicate 0.9a1 major high jpellerin

Missing unittests for many core functions:

03/27/06

0.10

Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#104 rewrite test loading/importing/suites to be easier to follow nose assigned None 0.9.1 normal highest jpellerin

The code for test loading, suites and imports is convoluted and difficult to follow. It should be simplified and clarified.

11/17/06
#103 Run fictures (setup/teardown) only for modules or packages that contain tests nose reopened 0.9.1 major high jpellerin

my directory structure:

proj/module1/__init__.py(has setup/teardown)
            module1.py
proj/module2/__init__.py(has setup/teardown)
            module2.py

When I run below in proj dir:

nosetests module1 -vv I found although only module1.py is running but both module1 package setup/teardown and module2's has run. that means I have to run: nosetests module1 -e module2 to exclude module2.

is there a way to run module1 package's test only? I know I could run `nosetest -w module1`, but this way can't call package setup/teardown.

12/06/06
#117 nose-0.10.0a1 doesn't handle string exceptions nose new None normal normal jpellerin

raise a string exception in a test, nose will:

Traceback (most recent call last):
  File "/usr/local/lib/python2.4/site-packages/nose-0.10.0a1-py2.4.egg/nose/case.py", line 143, in run
    self.runTest(result)
  File "/usr/local/lib/python2.4/site-packages/nose-0.10.0a1-py2.4.egg/nose/case.py", line 161, in runTest
    test(result)
  File "/usr/local/lib/python2.4/unittest.py", line 281, in __call__
    return self.run(*args, **kwds)
  File "/usr/local/lib/python2.4/unittest.py", line 267, in run
    result.addError(self, self.__exc_info())
  File "/usr/local/lib/python2.4/site-packages/nose-0.10.0a1-py2.4.egg/nose/proxy.py", line 108, in addError
    plugins.addError(self.test, err)
  File "/usr/local/lib/python2.4/site-packages/nose-0.10.0a1-py2.4.egg/nose/plugins/manager.py", line 36, in __call__
    return self.call(*arg, **kw)
  File "/usr/local/lib/python2.4/site-packages/nose-0.10.0a1-py2.4.egg/nose/plugins/manager.py", line 89, in simple
    result = meth(*arg, **kw)
  File "/usr/local/lib/python2.4/site-packages/nose-0.10.0a1-py2.4.egg/nose/plugins/errorclass.py", line 132, in addError
    if filter(lambda c: issubclass(err_cls, c), classes):
  File "/usr/local/lib/python2.4/site-packages/nose-0.10.0a1-py2.4.egg/nose/plugins/errorclass.py", line 132, in <lambda>
    if filter(lambda c: issubclass(err_cls, c), classes):
TypeError: issubclass() arg 1 must be a class
07/10/07
#89 would like common interface for all test wrapper objects nose assigned None enhancement normal jpellerin

It would be convenient/efficient/and future-safe to access all of nose's internal test wrappers with a common interface. That is, convenient for the nose-watch plugin ;)

Here is an initial idea, open to suggestions. I should point out that these are the only things that nose-watch needs to access, so a complete interface might want more.

  • wrapper.getTestObject()
    • the actual test (i.e. FunctionTestCase.testFunc or TestModule.module or unittest.TestCase._'_class_'_)
  • wrapper.getTestFile()
    • this one has proven itself really tricky and maybe nose has a better way to do it since it is already looking for tests in the filesystem. Currently I am working around unloadable modules by overloading the load_source() method in ihooks.Hooks. There is also a big problem that I'm not sure is solvable in aliased modules (i.e. "from main import foo" when when foo.py exists in main/foo/foo.py, concealed by main/foo/init.py). I think inspect.getfile() is the one to blame for that, but I haven't looked into it too far other than knowing it's not working how I would like it.
  • wrapper.getTestAddress()
    • get a string "address" of a test. That is, a name that could be put on the command line of a nosetests call to run this test again. I'm thinking that any unittest.TestCase method could only return the filename of its module?

We should talk before you start work on this ... or perhaps I will just add a patch or two to this ticket if I get around to it first. I'll wait until 0.9.1 is out the door.

11/21/06
#84 Generator tests with mutable arguments = bad nose assigned None normal normal jpellerin

From Kevin Dangoor:

A coworker found an interesting bug in test generators. Apparently,
py.test does the same thing. Maybe this is architecturally difficult
to contend with. Here's the test:

#! /usr/bin/env python

def test_list_loop():
   def check_list_loop(ls, len_expected):
       print ls
       assert len(ls) == len_expected
   ls = list()
   for i in range(0, 6):
       ls.append(i)
       yield check_list_loop, ls, i + 1

It appears that each yielded test is not run immediately, but is
collected up and *then* run. In this particular case, that fails
because a mutable object is involved (and mutated as part of the test
running). Changing that last line to

       yield check_list_loop, ls[:], i + 1

makes it work, because you're dealing with copies of the list each time.
11/21/06
Ticket Summary Component Status Resolution Version Severity Priority Owner Description Modified
#115 --with-doctest fails totaly with some of the docstrings nose:plugin:doctest new None 0.9.1 blocker highest jpellerin

nose's --with-doctest will fail with the following class doctest's:

class CatalogHeader:
    """Representation of a gettext catalog header"""
    def __init__(self, encoding='utf-8'):
        self.encoding = encoding
        self._comments = []
        self._headers = {
            ProjectIdVersion: (
                u'Project-Id-Version', u'PROJECT VERSION'
            ),
            ReportMsgidBugsTo: (
                u'Report-Msgid-Bugs-To', u'ADDRESS@EMAIL'
            ),
            POTCreationDate: (
                u'POT-Creation-Date', u'YEAR-MO-DA HO:MI+ZONE'
            ),
            PORevisionDate: (
                u'PO-Revision-Date', u'YEAR-MO-DA HO:MI+ZONE'
            ),
            LastTranslator: (
                u'Last-Translator', u'FULL NAME <EMAIL@ADDRESS>'
            ),
            LanguageTeam: (
                u'Language-Team', u'LANGUAGE <LL@li.org>'
            ),
            MIMEVersion: (
                u'MIME-Version', u'1.0'
            ),
            ContentType: (
                u'Content-Type', u'text/plain; charset=UTF-8'
            ),
            ContentTransferEncoding: (
                u'Content-Transfer-Encoding', u'8bit'
            ),
            PluralForms: (
                u'Plural-Forms', u'nplurals=INTEGER; plural=EXPRESSION;'
            )
        }
        self.fuzzy = False

    def __str__(self):
        output = self.generate()
        if not isinstance(output, str):
            output = output.encode(self.encoding)
        return output

    def __unicode__(self):
        output = self.generate()
        if not isinstance(output, unicode):
            output = unicode(output, self.encoding)
        return output

    def __repr__(self):
        return '<%s>' % self.__class__.__name__

    def generate(self):
        """Generates the catalog header output."""
        txt = u''.join([u'# %s\n' % x for x in self._comments]) + u'#\n'
        if self.fuzzy:
            txt += u'#, fuzzy\n'
        txt += u'msgid ""\nmsgstr""\n'
        for key, val in self._headers.values():
            txt += u'"%s: %s\\n"\n' % (key, val)
        return txt

    def comments(self):
        """Get the comments the header has

        >>> ch = CatalogHeader()
        >>> ch.add_comment('Translation Template for Project XY')
        >>> ch.add_comment('Copyright FooBar 2010')
        >>> ch.comments()
        [u'Translation Template for Project XY', u'Copyright FooBar 2010']
        """
        return self._comments

    def headers(self):
        """Returns the headers.

        >>> ch = CatalogHeader()
        >>> ch.headers()            #doctest: +SKIP
        [(u'Project-Id-Version', u'PROJECT VERSION'),
         (u'Report-Msgid-Bugs-To', u'ADDRESS@EMAIL'),
         (u'POT-Creation-Date', u'YEAR-MO-DA HO:MI+ZONE'),
         (u'PO-Revision-Date', u'YEAR-MO-DA HO:MI+ZONE'),
         (u'Last-Translator', u'FULL NAME <EMAIL@ADDRESS>'),
         (u'Language-Team', u'LANGUAGE <LL@li.org>'),
         (u'MIME-Version', u'1.0'),
         (u'Content-Type', u'text/plain; charset=UTF-8'),
         (u'Content-Transfer-Encoding', u'8bit'),
         (u'Plural-Forms', u'nplurals=INTEGER; plural=EXPRESSION;')]
        """
        return self._headers.values()

    def add_comment(self, comment):
        """Add comments to the catalog header.

        >>> ch = CatalogHeader()
        >>> ch.add_comment('Translation Template for Project XY')
        >>> ch.add_comment('Copyright FooBar 2010')
        >>> print ch
        # Translation Template for Project XY
        # Copyright FooBar 2010
        #
        msgid ""
        msgstr""
        "Project-Id-Version: PROJECT VERSION\n"
        "Report-Msgid-Bugs-To: ADDRESS@EMAIL\n"
        "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
        "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
        "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
        "Language-Team: LANGUAGE <LL@li.org>\n"
        "MIME-Version: 1.0\n"
        "Content-Type: text/plain; charset=UTF-8\n"
        "Content-Transfer-Encoding: 8bit\n"
        "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
        <BLANKLINE>
        """

        if comment not in self._comments:
            self._comments.append(unicode(comment))

    def set_project_id_version(self, project, version):
        """Set the 'Project-Id-Version' header.

        >>> ch = CatalogHeader()
        >>> ch.set_project_id_version('Foo Project', 0.2)
        >>> print ch
        #
        msgid ""
        msgstr""
        "Project-Id-Version: Foo Project 0.2\n"
        "Report-Msgid-Bugs-To: ADDRESS@EMAIL\n"
        "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
        "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
        "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
        "Language-Team: LANGUAGE <LL@li.org>\n"
        "MIME-Version: 1.0\n"
        "Content-Type: text/plain; charset=UTF-8\n"
        "Content-Transfer-Encoding: 8bit\n"
        "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
        <BLANKLINE>
        """
        self._headers[ProjectIdVersion] = (
            self._headers[ProjectIdVersion][0],
            u'%s %s' % (unicode(project), unicode(version))
        )

    def set_report_msgid_bugs_to(self, value):
        self._headers[ReportMsgidBugsTo] = (
            self._headers[ReportMsgidBugsTo][0],
            unicode(value)
        )

    def set_pot_creation_date(self, value):
        self._headers[POTCreationDate] = (
            self._headers[POTCreationDate][0],
            unicode(value)
        )

    def set_po_revision_date(self, value):
        self._headers[PORevisionDate] = (
            self._headers[PORevisionDate][0],
            unicode(value)
        )

    def set_last_translator(self, value):
        self._headers[LastTranslator] = (
            self._headers[LastTranslator][0],
            unicode(value)
        )

    def set_language_team(self, value):
        self._headers[LanguageTeam] = (
            self._headers[LanguageTeam][0],
            unicode(value)
        )

    def set_mime_version(self, value):
        self._headers[MIMEVersion] = (
            self._headers[MIMEVersion][0],
            unicode(value)
        )

    def set_content_type(self, ctype, charset):
        self._headers[ContentType] = (
            self._headers[ContentType][0],
            u'%s; charset=%s' % (unicode(ctype), unicode(charset))
        )

    def set_content_transfer_encoding(self, value):
        self._headers[ContentTransferEncoding] = (
            self._headers[ContentTransferEncoding][0],
            unicode(value)
        )

    def set_plural_forms(self, nplurals, expression):
        self._headers[PluralForms] = (
            self._headers[PluralForms][0],
            u'nplurals=%s; plural=%s;' % (unicode(nplurals), unicode(expression))
        )

    def set_custom_header(self, name, value):
        self._headers[len(self._headers)+1] = (unicode(name), unicode(value))

    def set_fuzzy(self):
        self.fuzzy = True

    def unset_fuzzy(self):
        self.fuzzy = False
nosetests --with-doctest catalog.CatalogHeader

----------------------------------------------------------------------
Ran 0 tests in 0.008s

OK

The problem seems to be on methods add_comment() and set_project_id_version().

01/03/07
#13 update selftest.py nose:selftest assigned None normal high jpellerin

Update selftest to account for the new tests in units and unit support.

06/22/06
#121 can't specify multiple cover-package values in setup.cfg nose new None normal normal jpellerin

In setup.cfg there's no way to define multiple packages to produce coverage output for since repeating options overrides the previous values:

[nosetests]
cover-package=foo
cover-package=bar

The second value of "bar" will override the first.

Since the option parsing for "--cover-package" uses action="append" the value is already a list, so when it's passed to tolist() it's not split, so using comma separated values like "cover-package=foo,bar" also does not work.

10/10/07
#120 Problem with python setup.py nosetests --stop nose new None normal normal jpellerin

When I run it I get:

running nosetests
running egg_info
writing requirements to WebError.egg-info/requires.txt
writing WebError.egg-info/PKG-INFO
writing top-level names to WebError.egg-info/top_level.txt
writing dependency_links to WebError.egg-info/dependency_links.txt
writing entry points to WebError.egg-info/entry_points.txt
reading manifest file 'WebError.egg-info/SOURCES.txt'
writing manifest file 'WebError.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 35, in ?
    entry_points="""
  File "distutils/core.py", line 149, in setup
  File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command
    cmd_obj.run()
  File "/home/ianb/env/webdev/lib/python2.4/nose-0.10.0b1-py2.4.egg/nose/commands.py", line 110, in run
    lambda o: o.replace('_', '-')))
  File "/home/ianb/env/webdev/lib/python2.4/nose-0.10.0b1-py2.4.egg/nose/config.py", line 399, in cfgToArg
    if flag(value):
  File "/home/ianb/env/webdev/lib/python2.4/nose-0.10.0b1-py2.4.egg/nose/config.py", line 451, in flag
    if len(val) > 5:
TypeError: len() of unsized object
09/22/07
#119 --with-coverage not working with easy_installed Version of coverage nose new None normal normal jpellerin

Mac OSX Python 2.4.4 Nose-0.10.0b1 Coverage-2.77

nosetests works just fine

nosetests --with-coverage breaks like this:

Traceback (most recent call last):

File "/usr/local//bin/nosetests", line 7, in ?

sys.exit(

File "/usr/local/lib/python2.4/site-packages/nose-0.10.0b1-py2.4.egg/nose/core.py", line 188, in init

argv=argv, testRunner=testRunner, testLoader=testLoader)

File "/usr/local/lib/python2.4/unittest.py", line 758, in init

self.parseArgs(argv)

File "/usr/local/lib/python2.4/site-packages/nose-0.10.0b1-py2.4.egg/nose/core.py", line 203, in parseArgs

self.config.configure(argv, doc=TestProgram?.doc)

File "/usr/local/lib/python2.4/site-packages/nose-0.10.0b1-py2.4.egg/nose/config.py", line 170, in configure

self.plugins.configure(options, self)

File "/usr/local/lib/python2.4/site-packages/nose-0.10.0b1-py2.4.egg/nose/plugins/manager.py", line 201, in configure

cfg(options, config)

File "/usr/local/lib/python2.4/site-packages/nose-0.10.0b1-py2.4.egg/nose/plugins/manager.py", line 79, in call

return self.call(*arg, **kw)

File "/usr/local/lib/python2.4/site-packages/nose-0.10.0b1-py2.4.egg/nose/plugins/manager.py", line 135, in simple

result = meth(*arg, **kw)

File "/usr/local/lib/python2.4/site-packages/nose-0.10.0b1-py2.4.egg/nose/plugins/cover.py", line 66, in configure

import coverage

File "/usr/local/bin/coverage.py", line 5, in ?

pkg_resources.run_script('coverage==2.77', 'coverage.py')

File "/usr/local/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg/pkg_resources.py", line 448, in run_script

self.require(requires)[0].run_script(script_name, ns)

File "/usr/local/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg/pkg_resources.py", line 1166, in run_script

execfile(script_filename, namespace, namespace)

File "/usr/local/lib/python2.4/site-packages/coverage-2.77-py2.4.egg/EGG-INFO/scripts/coverage.py", line 8, in ?

coverage.the_coverage.command_line(sys.argv[1:]) AttributeError?: 'module' object has no attribute 'the_coverage'

let me know if you need any more info.

chris chris@percious.com

10/01/07
#118 String exceptions break nose nose new None normal normal jpellerin

If you raise a string exception in a test, like raise "exception", nose breaks in a couple places. Mostly when using issubclass(exc, some_class), because exc is actually a string at that point. An extra test with those issubclass calls should fix it.

08/11/07
#116 nose doesn't allow yielding of just a function nose new None normal normal jpellerin

If you don't yield a function with arguments, but rather just a function, nose will not work. Patch to fix this attached.

02/06/07
#114 nosetests 0.9.1 leaks 0-byte temporary files under Windows nose new None 0.9.1 normal normal jpellerin

I just noticed that nosetests 0.9.1 creates and leaves behind one temporary file each time it executes, running a test.

Under Windows, the file are left in C:\Windows\Temp and have names similar to tmpxxxxx. It is probably a file name created by tempfile module function somewhere.

These files should be deleted when nosetests terminates.

I am not running any plugins. The test is very simple. Even an empty test creates a temp file leak.

12/17/06
#47 optimize startup time for lib/ test/ and package/ test/ cases nose assigned None normal normal jpellerin

Startup time for layouts like:

- lib/ - test/

Or:

- package/ - test/

Is very bad, since nose examines everyting in package/ and lib/ before looking in test/. This should be fixable, since it's only looking in the libs first to be sure that their root dirs are in sys.path before the tests are loaded.

06/22/06
#97 @with_setup not calling teardown() if test raises exception nose closed duplicate 0.9.1 normal normal jpellerin

I'm not sure if this is desired behvior or not, but I noticed that if a test function decorated with @with_setup() raises an exception then the teardown() method is not called. My personal choice is that a teardown function is called in a finally block as the test is run, to *always* undo what was done by setup.

I took a [very] quick stab at adding a test to nose's suite for this but couldn't come up with one since setup and teardown are just properties set on the test method. hmm. Was using revision 98.

-Kumar McMillan?

10/22/06
#87 nose-django fails for apps with no models.py nose:plugins closed fixed normal normal jpellerin

nose-django fails at nosedjango.py line 141, for any app which has no models.py (e.g. django/contrib/markup)

Since it's not required to have a models.py file in every app, should begin() protect itself, e.g. only run management.install where load_app(app) is not None ?

or you could say it's a fault in django. a blank models.py fixes it.

09/06/06
#88 call to debug log raises IndexError nose closed fixed 0.9.1 normal normal jpellerin

some straggler debug code from a condition yet to be evaluated is raising an IndexError?. This is in selector.py, revision 94. Here is a patch.

09/06/06
#82 NameError in class def *only* when running nosetests nose closed invalid 0.9.1 normal normal jpellerin

I could be missing something obvious, but this has me completely stumped. I figure you know more about the environment that nose imports code into so, I dunno, take a look and let me know what you think.

Try this:

svn co --revision=238 http://svn.testtools.python-hosting.com/trunk/ testtools_238
cd testtools_238
nosetests -v testtools/testself/test_fixtures/test_storable.py

all tests should pass. now, open up testtools/testself/test_fixtures/test_storable.py and edit a few things :

  • change mknewfile2 on line 241 to mknewfile
  • change mknewfile2 on line 249 to mknewfile

now run it again and you should get :

Traceback (most recent call last):
  File "/Users/kumar/tmp/tt_nose_flop/testtools/testtools/testself/test_fixtures/test_storable.py", line 246, in test_mknewfile
    class MyAutoCsv(CsvFixture):
  File "/Users/kumar/tmp/tt_nose_flop/testtools/testtools/testself/test_fixtures/test_storable.py", line 247, in MyAutoCsv
    class meta:
  File "/Users/kumar/tmp/tt_nose_flop/testtools/testtools/testself/test_fixtures/test_storable.py", line 249, in meta
    mknewfile = mknewfile
NameError: name 'mknewfile' is not defined

now ... to make sure we're all sane, shouldn't the exact same error happen when we simply compile the code?

python testtools/testself/test_fixtures/test_storable.py

Yet it does not. In addition, I have tried to reproduce a similar NameError? in the python shell without success. And I've also tried taking that test function out of the unittest.TestCase class so that it is a standalone def, it still failed. I guess it's some kind of referencing issue but I can't think of any reason why this could happen *only* in nose.

- kumar

08/24/06
#77 Importer bug for modules starting with underscore nose:importer closed invalid 0.9.1 normal normal jpellerin

I will paste the session dump that presents the issue here. Files needed to reproduce this in attachement.

$ nosetests --verbose --include \(unit\)\|\(functional\)
No handlers could be found for logger "nose.plugins"
test_from_functional.TestFunctional.test_functional ... ok
ERROR

======================================================================
ERROR: test module test_from_unit in /tmp/blah/tests/unit
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/nose-0.9.1.dev_r77-py2.3.egg/nose/suite.py", line 44, in run
    self.setUp()
  File "/usr/lib/python2.3/site-packages/nose-0.9.1.dev_r77-py2.3.egg/nose/suite.py", line 187, in setUp
    self.module = _import(self.moduleName, [self.path], self.conf)
  File "/usr/lib/python2.3/site-packages/nose-0.9.1.dev_r77-py2.3.egg/nose/importer.py", line 96, in _import
    mod = load_module(fqname, fh, filename, desc)
  File "/tmp/blah/tests/unit/test_from_unit.py", line 1, in ?
    from _helper import fun1
ImportError: cannot import name fun1

----------------------------------------------------------------------
Ran 1 test in 0.006s

FAILED (errors=1)

$ nosetests --verbose --include unit
No handlers could be found for logger "nose.plugins"
test_from_unit.TestUnit.test_unit ... ok

----------------------------------------------------------------------
Ran 1 test in 0.004s

OK

$ nosetests --verbose --include functional
No handlers could be found for logger "nose.plugins"
test_from_functional.TestFunctional.test_functional ... ok

----------------------------------------------------------------------
Ran 1 test in 0.004s

OK
08/04/06
#67 Hard to embed tests in existing modules nose:collector closed wontfix enhancement normal jpellerin

I often like to put a few tests in my Python modules, and it would be nice to use 'nosetests' on them. However, nosetests fails to discover any tests because the modules aren't named test_*. Can we have a command-line option that looks for tests in the specified module regardless of its name? I tried making the module executable and using --exe but that didn't work.

06/21/06
#65 help text in doctest module inaccurate nose:plugin:doctest closed fixed minor normal jpellerin

... it's just missing the env vars in the help text even though they were being accessed already. (see patch)

06/01/06
#64 activate non nose loggers through --debug nose closed fixed normal normal jpellerin

I think that you should be able to activate other loggers for your application through --debug. Imagine I am unit testing a piece of code that uses the logger "application.component". Now, in the normal run of the application the handler for this is set up by some piece of code that is not being run during the unit test. However, the unit tests fail, and I want to quickly activate the logger so I can see what went wrong. I think I should be able to write "nosetests ---debug=application.component" and see the log messages.

I have attached a patch that fixes this.

06/01/06
#20 nose 0.8.7.1 fails with TurboGears tests nose closed fixed 0.8.7.1 normal high jpellerin

Running nosetests from the toplevel directory of a TurboGears? trunk checkout fails after this:

      Full path to turbogears.fastdata.tests.formmodel is /Users/tazzzzz/projects/turbogears/turbogears.fastdata.tests.formmodel
      test 'turbogears.fastdata.tests.formmodel' resolves to 'turbogears.fastdata.tests.formmodel' in '/Users/tazzzzz/projects/turbogears' (<class 'nose.core.TestModule'>)
      running test test module turbogears.fastdata.tests.formmodel in /Users/tazzzzz/projects/turbogears
    Import turbogears.fastdata.tests.formmodel from /Users/tazzzzz/projects/turbogears

It complains of the database not being configured. I am able to import formmodel without any problem from a python prompt, so it's not just an import that causes a problem. It seems like Nose is actually trying to run something in there.

03/22/06
Note: See TracReports for help on using and creating reports.