nose Questions

3

I am writing a unit test for embedded software code in python. One of the files require a specific file to exist. (e.g. "/dir_name/file_name.txt") otherwise it raises an error. Normally, this fil...
Somersomers asked 22/10, 2016 at 0:57

4

We've just switched from nose to pytest and there doesn't seem to be an option to suppress third party logging. In nose config, we had the following line: logging-filter=-matplotlib,-chardet.charse...
Tarpeia asked 23/3, 2021 at 10:14

4

Solved

Python's unittest discover does not find my tests! I have been using nose to discover my unit tests and it is working fine. From the top level of my project, if I run nosetests I get: Ran 31 test...
Ferric asked 23/2, 2011 at 9:20

2

Solved

I am trying to write some nose tests for a python project. It has been a while (a year or so) since I last wrote some nostests and it looks like nose2 is the suggested module to use for this now. ...
Lemar asked 25/2, 2014 at 17:57

5

I am trying to assert that two dictionaries are almost equal, but I can't seem to do that. Here is an example: >>> import nose.tools as nt >>> nt.assert_dict_equal({'a' : 12.4},...
Millrace asked 8/5, 2014 at 18:8

4

I have wrote unit test cases to test my application. and it is working as expected with out issues. below is some sample testcase import os import unittest class CreateUser(unittest.TestCase): ...
Illiterate asked 10/5, 2015 at 5:54

3

Solved

I have a python function that returns multiples values. My function: def myExampleFunction(a,b) # here is my code return name, number1, number2 def FunctionIWantToTest(self): # here is my cod...
Dara asked 3/3, 2016 at 13:53

2

Solved

I'm having trouble actually skipping a unit test from a Nose2 plugin. I am able to mark the test skipped and see the reason in the final result, but the test still runs. This example code should ba...
Oglethorpe asked 8/7, 2014 at 18:57

4

Solved

I have a function I want to unit test contains calls two other functions. I am unsure how can I mock both functions at the same time properly using patch. I have provided an example of what I mean ...
Everywhere asked 2/4, 2013 at 11:52

15

Solved

Is it possible to get the results of a test (i.e. whether all assertions have passed) in a tearDown() method? I'm running Selenium scripts, and I'd like to do some reporting from inside tearDown(),...
Tog asked 10/12, 2010 at 23:37

5

I'm writing test cases for code that is called via a route under Flask. I don't want to test the code by setting up a test app and calling a URL that hits the route, I want to call the function dir...
Acculturize asked 19/4, 2016 at 21:31

5

Solved

It seems that python nosetest will quit when encountered sys.exit(), and mocking of this builtin doesn't work.
Systematism asked 30/11, 2011 at 19:54

3

Solved

I have two files spike.py class T1(object): def foo(self, afd): return "foo" def get_foo(self): return self.foo(1) def bar(): return "bar" test_spike.py: from unittest import TestCase ...
Leucoma asked 27/11, 2013 at 12:43

9

Solved

I installed Nose on a Mac OSX 10.10.5 with Python2.7.9 using easy_install. The installation appeared to be successful: Collecting nose Downloading nose-1.3.7-py2-none-any.whl (154kB) 100% |████...
Cowskin asked 13/9, 2015 at 4:16

3

On different input values posted to a url of my flask application, it flashes different messages, e.g. 'no data entered', 'invalid input', 'no record found', '3 records found'. Can someone guide h...
Peppard asked 8/4, 2015 at 7:34

2

Solved

I'm looking for something like ruby rspec's focus metadata or elixir's mix tags to run a single python test. Ruby RSpec Example: # $ rspec spec it 'runs a single test', :focus do expect(2).to ...
Necktie asked 23/7, 2017 at 16:40

4

Solved

In Python testing, why would you use assert methods: self.assertEqual(response.status_code, 200) self.assertIn('key', my_dict) self.assertIsNotNone(thing) As opposed to the direct assertions: a...
Rabush asked 3/11, 2015 at 5:28

3

Solved

I use nosetest's coverage.py plugin. Is it somehow possible to exclude entire files or folders from the coverage report? My use case is having an external library in my project folder that obviousl...
Jerroldjerroll asked 30/8, 2012 at 15:36

1

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....
Spirelet asked 18/11, 2009 at 19:15

5

Solved

I do have several small modules where the tests are inside them and py.test or nose does not look for them because they do not contain test in their filename. How can I convince py.test or nose to...
Dossal asked 8/9, 2010 at 17:46

1

Solved

Context I have a test class where all my tests inherit from. It cant run by itself as it really doesnt contain any setup info I wanted to add a test which is executed by ALL tests (adding it to the...
Dogberry asked 7/9, 2021 at 16:33

2

Solved

I can't seem to get code coverage with Nose to work, despite having the plugin installed. Any ideas on how to fix this? 12:15:25 ~/sandbox/ec$ nosetests --plugins Plugin xunit Plugin deprecated P...
Melamine asked 23/1, 2013 at 20:17

8

I was using the Decision Tree and this error was raised. The same situation appeared when I used Back Propagation. How can I solve it? import pandas as pd import numpy as np a = np.test() f = open(...
Gatt asked 25/12, 2019 at 1:25

13

I'm writing tests for a function like next one: def foo(): print 'hello world!' So when I want to test this function the code will be like this: import sys from foomodule import foo def test_foo(...
Devon asked 18/11, 2010 at 21:22

5

Solved

I want to ignore certain decorators on my code to have the associated functionality skipped, but only when running as a part of a unit test. Can this be done? For example I have a function f, defi...
Showboat asked 23/12, 2017 at 21:36

© 2022 - 2025 — McMap. All rights reserved.