Edgewall Software
Modify

Opened 17 years ago

Last modified 14 years ago

#147 new enhancement

Enable bitten to use nose unittests

Reported by: Pedro Algarvio, aka, s0undt3ch <ufs@…> Owned by: cmlenz
Priority: minor Milestone: 0.6.1
Component: Recipe commands Version: dev
Keywords: nose Cc: tomasz.sterna@…, davidf@…, felix.schwarz@…, number5@…
Operating System: Linux

Description

I've made a package for those of us who use nose as the unittests utility. It includes both nose and bitten plugins.

They're under the nose namespace just to diferentiate.

Regarding Nose:

  • XML Output of tests results
  • XML Output of coverage report

Regarding Bitten:

  • nosetests recipe command: calls nosetests. Default args are --with-bitten to call our nose bitten plugin which writes the tests results into XML
  • coverage recipe command: mimics the trace recipe command but using nose's coverage output.
  • unittest recipe command: it's basicly a copy of bitten's unittest recipe command.

Here's a sample of my recipe for using this package:

<build xmlns:python="http://bitten.cmlenz.net/tools/python"
       xmlns:nose="http://bitten.cmlenz.net/tools/nose">

  <step id="build" title="Let Distutils build the python code">
    <python:distutils command="build"/>
  </step>

  <step id="nosetests" title="Unit tests" description="Run unit tests and record code coverage">
    <nose:nosetests packages="i18ntoolbox" verbose="True" doctests="True" coverage="True" args="--cover-erase --cover-tests"/>
    <nose:unittest file="build/test-results.xml"/>
    <nose:coverage file="build/coverage-results.xml"/>
  </step>

  <step id="dist" title="Package up distributions" onerror="ignore">
    <python:distutils command="sdist"/>
    <python:distutils command="bdist_egg"/>
  </step>

</build>

This ticket was created to make my work available to other and to inquire cmlenz if this should/could or not be included into bitten.

Attachments (8)

setup.py (1.3 KB) - added by Pedro Algarvio, aka, s0undt3ch <ufs@…> 17 years ago.
plugbitten.py (3.0 KB) - added by Pedro Algarvio, aka, s0undt3ch <ufs@…> 17 years ago.
plugnose.py (8.4 KB) - added by Pedro Algarvio, aka, s0undt3ch <ufs@…> 17 years ago.
bittenextratrac-noseworking.patch (3.2 KB) - added by dfraser 16 years ago.
Patch to Bitten Extra Trac? svn that actually lets nosetests work
bittenextranose-fixturerequired.patch (653 bytes) - added by dfraser 16 years ago.
Patch to Bitten Extra Nose? so fixtures work properly
bittenextranose-mkdir.patch (803 bytes) - added by dfraser 16 years ago.
Patch to Bitten Extra Nose? to create directory for xml output
bittenextranose-plugin010.patch (1.9 KB) - added by dfraser 16 years ago.
Patch to Bitten Extra Nose? so it works with nose 0.10 style plugins
nose2bitten.xslt (1.5 KB) - added by Pedro Ferreira <pedro.ferreira@…> 13 years ago.
I have created a small XSLT that translates nosetests XUtil output into a Bitten unit test report. I haven't tested it extensively, but should work reasonably well.

Download all attachments as: .zip

Change History (33)

Changed 17 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

Changed 17 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

Changed 17 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

comment:1 Changed 17 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

  • Summary changed from Enable nose for bitten to Enable bitten to use nose unittests

Anyone using this package, please report problems to me, not cmlenz.

comment:2 Changed 17 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

The package is now also online here, just to keep it under version control.

To get it:

svn co http://i18ntoolbox.ufsoft.org/svn/sandbox/nosebitten

comment:3 Changed 17 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

cmlenz, please delete the attached files, the subversion source is what should be considered since there has been some changes on it and I don't want to flood the ticket with attachments.

comment:4 Changed 17 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

Using the trunk version on nose makes things easier, you just need to include the nose options on the projects setup.cfg, for example:

[nosetests]
verbose=True
verbosity=2
with-doctest=True
with-coverage=True
with-bitten=True
with-bitten-coverage=True
cover-erase=True
cover-package=i18ntoolbox

And here's the recipe:

<build xmlns:python="http://bitten.cmlenz.net/tools/python"
       xmlns:nose="http://bitten.cmlenz.net/tools/nose">

  <step id="build" title="Let Distutils build the python code">
    <python:distutils command="build"/>
  </step>

  <step id="nosetests" title="Unit tests" description="Run unit tests and record code coverage">
    <python:distutils command="nosetests"/>
    <nose:unittest file="build/test-results.xml"/>
    <nose:coverage file="build/coverage-results.xml"/>
  </step>

  <step id="sdist" title="Package up sdist distributions" onerror="ignore">
    <python:distutils command="sdist"/>
  </step>

  <step id="bdist_egg" title="Package up bdist_egg distributions" onerror="ignore">
    <python:distutils command="bdist_egg"/>
  </step>

</build>

comment:5 follow-up: Changed 16 years ago by tomasz.sterna@…

http://i18ntoolbox.ufsoft.org/svn/sandbox/nosebitten is not valid anymore. Where can I find current plugin version?

comment:6 Changed 16 years ago by tomasz.sterna@…

  • Cc tomasz.sterna@… added

Adding CC: to get notified about changes.

comment:7 in reply to: ↑ 5 Changed 16 years ago by Pedro Algarvio, aka, s0undt3ch <ufs@…>

Replying to tomasz.sterna@sensisoft.com:

http://i18ntoolbox.ufsoft.org/svn/sandbox/nosebitten is not valid anymore. Where can I find current plugin version?

My latest source code is on:

http://bitten.ufsoft.org

Do note that cboos has asked me for the source, don't know if he changed it, improved it or where he hosts it now.

comment:8 Changed 16 years ago by davidf@…

  • Cc davidf@… added

comment:9 Changed 16 years ago by davidf@…

The latest Bitten Trac Plugin? from http://bitten.ufsoft.org doesn't work with latest 0.11 trac - I'm going to have a look at fixing it up...

comment:10 follow-up: Changed 16 years ago by gustavo@…

  • Cc gustavo@… added

So, is it impossible to run nose tests with Bitten? And there's no work-around either?

TIA.

comment:11 in reply to: ↑ 10 Changed 16 years ago by dfraser

Replying to gustavo@gnulinuxmatters.org:

So, is it impossible to run nose tests with Bitten? And there's no work-around either?

TIA.

I've fixed it up enough to make it work for us by piecing together the various versions and then patching it - I'll attach our current patch...

Changed 16 years ago by dfraser

Patch to Bitten Extra Trac? svn that actually lets nosetests work

Changed 16 years ago by dfraser

Patch to Bitten Extra Nose? so fixtures work properly

Changed 16 years ago by dfraser

Patch to Bitten Extra Nose? to create directory for xml output

Changed 16 years ago by dfraser

Patch to Bitten Extra Nose? so it works with nose 0.10 style plugins

comment:12 Changed 16 years ago by dfraser

Instructions

This should get it working

For Trac server

For slave

Please report back here how well this works for you

comment:13 Changed 16 years ago by adam.dziendziel@…

  • Cc adam.dziendziel@… added

comment:14 Changed 16 years ago by William.Rivet@…

I'm trying to understand and use this patch for gathering nosetest results and coverage.

I see that the nose plugin works and makes the XML files for me, using the suggestions about setup.cfg and sample recipe line: <python:distutils command="nosetests"/>

Where I am confused is that I don't see any code on the client side to provide the recipe commands for:

<nose:unittest file="build/test-results.xml"/> <nose:coverage file="build/coverage-results.xml"/>

And indeed when I run the recipe I get the following error: """Invalid Recipe Error?: Unknown recipe command http://bitten.cmlenz.net/tools/nose#unittest"""

Where is the client-side update that implements reading the coverage and nostests results stored in the .XML files and send them to the server?

comment:15 Changed 15 years ago by Miniwark

Apparently there is also a fork by mgood here :

http://github.com/mgood/bittenextranose/tree/master

But it' seems than the dfraser arre not applied on it. In any case not sure if this pluginf is maintained anymore by s0undt3ch.

comment:16 follow-up: Changed 15 years ago by Miniwark

After testing i asume than this plugin is not necessary anymore. With this the "inittest" recipe i and no use of the plugin i have been able to have correct Nose tests reports in Bitten :

  <step id="Test" description="Execute tests" onerror="continue">
      <python:distutils command="unittest" options="
      --xml-output build/test-results.xml
      --coverage-summary build/test-coverage.txt 
      --coverage-dir build/coverage"/>
      <python:unittest file="build/test-results.xml"/>
      <python:trace summary="build/test-coverage.txt"
      coverdir="build/coverage"/>
  </step>

No need of this plugin for this.

comment:17 Changed 15 years ago by mgood

Thanks for the update, I'll have to try that next time.

comment:18 Changed 15 years ago by osimons

  • Milestone changed from 0.6 to 0.6.1

Any conclusion on this issue? Does it work? Any more documentation needed perhaps?

comment:19 Changed 15 years ago by adam.dziendziel@…

  • Cc adam.dziendziel@… removed

comment:20 Changed 15 years ago by dfraser

I'm still living with my old setup - I can well imagine that the plugin is not really necessary. It definitely works with my old setup, but the setup is obtuse. I'll try test some time soon...

comment:21 Changed 15 years ago by gustavo@…

  • Cc gustavo@… removed

comment:22 in reply to: ↑ 16 Changed 14 years ago by Martin

And where did you start nosetest ? Is it configured as a test_suite in the setup.py (test_suite = 'nose.collector')? But then i don't get the coverage or results reports.

Replying to Miniwark:

After testing i asume than this plugin is not necessary anymore. With this the "inittest" recipe i and no use of the plugin i have been able to have correct Nose tests reports in Bitten :

  <step id="Test" description="Execute tests" onerror="continue">
      <python:distutils command="unittest" options="
      --xml-output build/test-results.xml
      --coverage-summary build/test-coverage.txt 
      --coverage-dir build/coverage"/>
      <python:unittest file="build/test-results.xml"/>
      <python:trace summary="build/test-coverage.txt"
      coverdir="build/coverage"/>
  </step>

No need of this plugin for this.

comment:23 Changed 14 years ago by Felix Schwarz <felix.schwarz@…>

  • Cc felix.schwarz@… added

comment:24 Changed 14 years ago by Bruce Wang <number5@…>

  • Cc number5@… added

comment:25 Changed 14 years ago by Miniwark

@Martin yes i have :
test_suite = 'nose.collector' in setup.py

and a [nosetests] section in setup.cfg :

[nosetests]
with-pylons = test.ini # It' a Pylons project you probably not need this
verbose=True
verbosity=2
detailed-errors=1

Changed 13 years ago by Pedro Ferreira <pedro.ferreira@…>

I have created a small XSLT that translates nosetests XUtil output into a Bitten unit test report. I haven't tested it extensively, but should work reasonably well.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain cmlenz.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.