nose

Running specs by tag

喜欢而已 提交于 2019-11-29 11:42:18
In Python and nosetests testing framework there is this idea of tagging your tests : from nose.plugins.attrib import attr @attr(speed='slow') def test_big_download(): ... and running the tests that have only specific tags: nosetests -a speed=slow This is very helpful when there is a need to run tests from a specific category or type. Is there anything similar in protractor + jasmine ? The closest functionality I've found is the 'grep' option introduced in 1.6.0 : protractor conf.js --grep='pattern to match' hankduan Grep is the closest you can get to this because there are no annotations in js

How to suppress verbose Tensorflow logging? [duplicate]

筅森魡賤 提交于 2019-11-29 11:33:11
问题 This question already has answers here : Disable Tensorflow debugging information (9 answers) Closed last year . I'm unittesting my Tensorflow code with nosetests but it produces such amount of verbose output that makes it useless. The following test import unittest import tensorflow as tf class MyTest(unittest.TestCase): def test_creation(self): self.assertEquals(True, False) when run with nosetests creates a huge amount of useless logging: FAIL: test_creation (tests.test_tf.MyTest) --------

A Nose plugin to specify the order of unit test execution

▼魔方 西西 提交于 2019-11-29 05:47:30
I have a desire to use Nose for an over the wire integration test suite. However, the order of execution of some of these tests is important. That said, I thought I would toss together a quick plugin to decorate a test with the order I want it executed: https://gist.github.com/Redsz/5736166 def Foo(unittest.TestCase): @step(number=1) def test_foo(self): pass @step(number=2) def test_boo(self): pass From reviewing the built in plugins I had thought, I could simply override loadTestsFromTestCase and order the tests by the decorated 'step number'.: def loadTestsFromTestCase(self, cls): """ Return

Installed Nose but cannot use on command line

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 02:27:29
问题 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% |████████████████████████████████| 155kB 2.3MB/s Installing collected packages: nose Successfully installed nose-1.3.7 But now, when I try even basic stuff with nosetests on the command line, like nosetests -h or which nosetests I just get: bash: nosetests: command not found I have tried uninstalling,

Passing options to nose in a Python test script

 ̄綄美尐妖づ 提交于 2019-11-29 01:48:59
Rather than running my nose tests from the command line, I'm using a test runner that sets up a few things for all the tests, including a connection to a local test instance of MongoDB. The documentation for nose only seems to indicate how to pass options through the command line or a configuration file located in your home directory. Is there a way to pass options, such as --with-xunit when using a script to run your tests? mouad Like this: import nose argv = ['fake', '--with-xunit'] nose.main(argv=argv) The "fake" argument must be added to stand in for the executable name, as described in

How to exclude mock package from python coverage report using nosetests

寵の児 提交于 2019-11-28 22:19:47
问题 I currently try to use the mock library to write some basic nose unittests in python. After finishing some basic example I now tried to use nosetests --with-coverage and now I have the mock package and the package I tried to 'mock away' are shown in the coverage report. Is there a possibility to exclude these? Here is the class I want to test: from imaplib import IMAP4 class ImapProxy: def __init__(self, host): self._client = IMAP4(host) And the testcase: from mock import patch from ImapProxy

How to set self.maxDiff in nose to get full diff output?

喜欢而已 提交于 2019-11-28 22:17:06
When using nose 1.2.1 with Python 3.3.0, I sometimes get an error message similar to the following one ====================================================================== FAIL: maxdiff2.test_equal ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python3.3/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/Users/loic/cmrsj/Calculus_II/scrap/maxdiff2.py", line 32, in test_equal assert_equal(str1, str2) AssertionError: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam

Mocking two functions with patch for a unit test

我的未来我决定 提交于 2019-11-28 21:53:51
问题 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 below. When I run nosetests, the tests pass but I feel that there must be a cleaner way to do this and I do not really Understand the piece regarding f.close()... The directory structure looks like this: program/ program/ data.py tests/ data_test.py data.py: import cPickle def write_out(file_path,

Run all Tests in Directory Using Nose

天大地大妈咪最大 提交于 2019-11-28 09:40:33
I need to be able to run all tests in the current directory by typing one line in the Linux shell. In some directories, this works fine. But in others, when I type "nosetests" no tests are run. The tests will run if I call for them individually but I need them to all run automatically. Here is one of the directories that won't work: /extwebserver __init__.py test_Detection.py test_Filesystem.py test_Hardware.py ... When I run "nosetests" in the parent directory, all tests in a certain subdirectory are run but no tests from /extwebserver or other subdirectories or the parent directory itself

How to change the message in a Python AssertionError?

可紊 提交于 2019-11-28 04:51:23
I'm writing per the following, in which I try to produce a decent error message when comparing two multiline blocks of Unicode text. The interior method that does the comparison raises an assertion, but the default explanation is useless to me I need to add something to code such as this below: def assert_long_strings_equal(one, other): lines_one = one.splitlines() lines_other = other.splitlines() for line1, line2 in zip(lines_one, lines_other): try: my_assert_equal(line1, line2) except AssertionError, error: # Add some information to the printed result of error??! raise I cannot figure out