2

I'm setting up a Python Continuous Integration server, using Jenkins, and nosetests keeps running the same tests twice. I'm not importing the tests anywhere. Here's the command I'm running:

nosetests --with-xcoverage --with-xunit --all-modules --traverse-namespace --cover-package=app --cover-inclusive --cover-erase -x

Any ideas? It's a Flask-Restful app.

Apollo Clark
  • 806
  • 9
  • 16
  • Could there be a link to the folder where tests are located? If the link is in one of the folders traversed during search this will happen if nose doesn't normalize paths it traverses and cache them. Have you tried running the command manually from a shell on server to see if same thing happens? If not happen from shell, perhaps you have two jenkins tasks defined. – Oliver Nov 21 '14 at 10:29
  • No folder links. I've run the command manually, still runs the unit tests twice. – Apollo Clark Nov 21 '14 at 16:10
  • What if you remove all command line options except what is necessary for nose to find the tests? – Oliver Nov 21 '14 at 17:19
  • Same results, even if I remove all the options. I'm guessing it has something to do with how the auto-import feature is operating, just trying to nail it down. – Apollo Clark Nov 24 '14 at 16:52
  • 1
    What if you remove all imports like flask in the test, and just put a couple dummy tests does it still run them twice? Also, what makes you say that they run twice? Did you turn on nose verbosity and debug to max level? – Oliver Nov 25 '14 at 03:02

2 Answers2

4

I had a similar issue. After turning up verbosity (as suggested by Schollii above) and comparing notes on this question what worked for me was deleting the init.py (and init.pyc of course) in my main code folder (of which tests were a subdirectory).

Community
  • 1
  • 1
Danimal
  • 1,208
  • 10
  • 21
0

I just had this one. Apparently I messed up the command line syntax. It's not:

nosetests module.py module.class_name

It's:

nosetests module.class_name

d33tah
  • 10,999
  • 13
  • 68
  • 158