nose2 / nose2 / tests / test_collect_plugin.py

jpellerin 07ee531 


jpellerin 91730e6 

jpellerin 07ee531 







jpellerin 91730e6 









jpellerin 07ee531 



































import re
import unittest2

from ._common import FunctionalTestCase, FakeStartTestRunEvent
from ..plugins import collect


class CollectOnlyFunctionalTest(FunctionalTestCase):
    def test_layout1(self):
        self.assertTestRunOutputMatches(
            self.runIn('layout1', '-v', '--collect-only'),
            stderr=EXPECT_LAYOUT1)

class TestCollectOnly(unittest2.TestCase):
    tags = ['unit']

    def setUp(self):
        self.plugin = collect.CollectOnly()

    def test_startTestRun_sets_executeTests(self):
        event = FakeStartTestRunEvent()
        self.plugin.startTestRun(event)
        self.assertEqual(event.executeTests, self.plugin.collectTests)


# expectations

EXPECT_LAYOUT1 = re.compile("""\
test_failed \(pkg1\.test\.test_things\.SomeTests\) \.\.\. ok
test_ok \(pkg1\.test\.test_things\.SomeTests\) \.\.\. ok
test_skippy \(pkg1\.test\.test_things\.SomeTests\) \.\.\. ok
test_typeerr \(pkg1\.test\.test_things\.SomeTests\) \.\.\. ok
unittest2\.case\.FunctionTestCase \(test_fixt\) \.\.\. ok
unittest2\.case\.FunctionTestCase \(test_func\) \.\.\. ok
pkg1\.test\.test_things\.test_gen:1
0, 0 \.\.\. ok
pkg1\.test\.test_things\.test_gen:2
1, 1 \.\.\. ok
pkg1\.test\.test_things\.test_gen:3
2, 2 \.\.\. ok
pkg1\.test\.test_things\.test_gen:4
3, 3 \.\.\. ok
pkg1\.test\.test_things\.test_gen:5
4, 4 \.\.\. ok
pkg1\.test\.test_things\.test_gen_nose_style:1
0, 0 \.\.\. ok
pkg1\.test\.test_things\.test_gen_nose_style:2
1, 1 \.\.\. ok
pkg1\.test\.test_things\.test_gen_nose_style:3
2, 2 \.\.\. ok
pkg1\.test\.test_things\.test_gen_nose_style:4
3, 3 \.\.\. ok
pkg1\.test\.test_things\.test_gen_nose_style:5
4, 4 \.\.\. ok

----------------------------------------------------------------------
Ran 16 tests in \d.\d+s

OK
""")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.