Questions tagged [nosetests]

nosetests is the the script name for running Python [nose] testing, a package for automated unit tests based on simple asserts and running all test*() functions in test*.py.

nosetests is the main script for running tests with automatic discover.

See documentation.

390 questions
8
votes
1 answer

setUpModule, tearDownModule and imports can be out of order under nose

I have some Python unittests that I am discovering and running with nose. I've observed some strange sequencing of the setUpModule(), tearDownModule() and imports of test modules. I have this (example) directory…
dbn
  • 13,144
  • 3
  • 60
  • 86
8
votes
2 answers

Nosetest and Google API: "no module named apiclient.discovery"

I'm trying to nosetest my little Python script that uses the Google Translate API. Where do I have to install the API or what do I have to do so nosetest stops telling me ImportError: No module named apiclient.discovery The script runs fine, I…
LukasKawerau
  • 1,071
  • 2
  • 23
  • 42
8
votes
1 answer

Turn off sqlalchemy warnings in nosetests

I'm trying to suppress all sqlalchemy warnings while running my test suite with nosetests. I read Turn off a warning in…
charlax
  • 25,125
  • 19
  • 60
  • 71
8
votes
4 answers

Change names of tests created by nose test generators

Nose has a bug - test names created by generators are not cached, so the error looks like it happened in the last test, not the actual test where it failed. I got around it following the solution in the bug report discussion, but it only works for…
M.K.
  • 346
  • 3
  • 14
7
votes
2 answers

python-nose: assertion library?

Is there a library which of nose-friendly assertions things like membership and identity (eg, assert_contains(x, y), assert_is(a, b))?
David Wolever
  • 148,955
  • 89
  • 346
  • 502
7
votes
2 answers

Is there a way to make freshen tests fail on undefined tests?

By default when I run a freshen scenario, which contains an undefined given/when/then clause, that test is simply marked as undefined. No further helpful message as to what actually isn't defined is given. Is there a way to change this behavior to…
VoY
  • 5,479
  • 2
  • 37
  • 45
7
votes
2 answers

nosetests --cover-html does not generate html docs

I have installed nose for python 2.6 and it works fine but I was trying use the --cover-html option to generate a html report. I typed the following command from the command line: nosetests --cover-html It ran the tests but did not generate the…
Gokul
  • 136
  • 6
7
votes
1 answer

Getting tests to parallelize using nose in python

I have a directory with lots of .py files (say test_1.py, test_2.py and so on) Each one of them is written properly to be used with nose. So when I run nosetests script, it finds all the tests in all the .py files and executes them. I now want to…
MK.
  • 3,907
  • 5
  • 34
  • 46
7
votes
2 answers

How am I getting 'InternalError: table "dev~guestbook!!Entities" already exists' when I just created datastore?

I'm trying to figure out how to setup Test Driven Development for GAE. I start the tests with: nosetests -v --with-gae I keep getting the error: InternalError: table "dev~guestbook!!Entities" already exists The datastore doesn't exist until I…
BryanWheelock
  • 12,146
  • 18
  • 64
  • 109
7
votes
1 answer

Using nosetests in PyCharm having python 2 and 3 installed side by side

I am trying to use nosetest with python 2 and 3 isntalled side by side in PyCharm (2.7.3). Everything works fine under python 2.7, but any test in python 3.4 fails with the following error: Traceback (most recent call last): File…
SmCaterpillar
  • 6,683
  • 7
  • 42
  • 70
7
votes
2 answers

Capturing output of subprocess.Popen() with nose

I'm using nose to test an application that uses subprocess.Popen() to call a script. Neither the capture or logcapture plugin seem to capture the output of this script. Is there an easy way to pipe this output to nose? Here's what I've attempted so…
pmdarrow
  • 734
  • 5
  • 14
7
votes
1 answer

How to set environment variables in travis-ci and access them from python script?

Our travis.yml looks like this: language: python python: - "2.7" env: - "MONGO_URL=mongodb://localhost/" services: mongodb # command to install dependencies install: "pip install -r requirements.txt" # command to run tests script:…
schreon
  • 1,097
  • 11
  • 25
7
votes
1 answer

Python nose test inheritance: load unit test fixtures from subclasses

I'm converting the test suite of a Python project from unittest to nose. The project's existing framework (based on unittest) is rather clunky, containing lots of heavily customised code for test discovery and running, so I'm trying to migrate to…
Boris
  • 1,180
  • 1
  • 18
  • 29
7
votes
1 answer

Nose: How to skip tests by default?

I am using Python's nose and I have marked some of my tests as "slow", as explained in the attrib plugin documentation. I would like to skip all "slow" Tests by default when running nosetests, i.e. without having to write nosetests -a '!slow'. But I…
André
  • 2,042
  • 1
  • 23
  • 26
7
votes
3 answers

Why does nosetests say --with-coverage is not an option?

I am using nosetests to automatically discover and run my unittests. I would also like to have it generate coverage reports. When I run nosetests with the following command everything works just fine nosetests . I looked up online that to generate…
rhololkeolke
  • 746
  • 2
  • 7
  • 25