File: test_withid_failures.rst

package info (click to toggle)
nose 1.3.7-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,712 kB
  • sloc: python: 15,697; makefile: 92; xml: 42; sh: 2
file content (50 lines) | stat: -rw-r--r-- 2,084 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    >>> import os
    >>> import sys
    >>> from nose.plugins.plugintest import run_buffered as run
    >>> from nose.plugins.testid import TestId
    >>> import tempfile
    >>> idfile = tempfile.mktemp()
    >>> support = os.path.join(os.path.dirname(__file__), 'support', 'id_fails')
    >>> argv = [__file__, '-v', '--with-id', '--id-file', idfile, support]
    >>> run(argv=argv, plugins=[TestId()]) # doctest: +ELLIPSIS
    #1 Failure: ...Error (No module ...apackagethatdoesntexist...) ... ERROR
    #2 test_b.test ... ok
    #3 test_b.test_fail ... FAIL
    <BLANKLINE>
    ======================================================================
    ERROR: Failure: ...Error (No module ...apackagethatdoesntexist...)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
    ...
    ...Error: No module ...apackagethatdoesntexist...
    <BLANKLINE>
    ======================================================================
    FAIL: test_b.test_fail
    ----------------------------------------------------------------------
    Traceback (most recent call last):
    ...
    AssertionError
    <BLANKLINE>
    ----------------------------------------------------------------------
    Ran 3 tests in ...s
    <BLANKLINE>
    FAILED (errors=1, failures=1)

Addressing failures works (sometimes).

    >>> argv.append('1')
    >>> _junk = sys.modules.pop('test_a', None) # 2.3 requires
    >>> run(argv=argv, plugins=[TestId()]) #doctest: +ELLIPSIS
    #1 Failure: ...Error (No module ...apackagethatdoesntexist...) ... ERROR
    <BLANKLINE>
    ======================================================================
    ERROR: Failure: ...Error (No module ...apackagethatdoesntexist...)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
    ...
    ...Error: No module ...apackagethatdoesntexist...
    <BLANKLINE>
    ----------------------------------------------------------------------
    Ran 1 test in ...s
    <BLANKLINE>
    FAILED (errors=1)