Skip to content

Commit

Permalink
nose: support skipped tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shalupov committed Oct 5, 2014
1 parent 3797e3c commit 034371a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .idea/runConfigurations/Integration_Nose.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions teamcity/nose_report.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# coding=utf-8
import os
import inspect
import sys

from teamcity import is_running_under_teamcity
from teamcity.unittestpy import TeamcityTestResult


class TeamcityReport(TeamcityTestResult):
name = 'teamcity-report'
score = 2
score = 10000

def __init__(self):
super(TeamcityReport, self).__init__()

self.enabled = False

def configure(self, options, conf):
self.enabled = is_running_under_teamcity()

Expand Down
4 changes: 2 additions & 2 deletions teamcity/unittestpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ def addExpectedFailure(self, test, err):

self.messages.testIgnored(self.test_name, message="Expected failure: " + err)

def addSkip(self, test, reason, *k):
def addSkip(self, test, reason="", *k):
TestResult.addSkip(self, test, reason)

self.messages.testIgnored(self.test_name, message="Skipped: " + reason)
self.messages.testIgnored(self.test_name, message="Skipped" + ((": " + reason) if reason else ""))

def addUnexpectedSuccess(self, test):
TestResult.addUnexpectedSuccess(self, test)
Expand Down
4 changes: 4 additions & 0 deletions tests/guinea-pigs/nose/skiptest/testa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from nose.plugins.skip import SkipTest

def test_func():
raise SkipTest('my skip')
15 changes: 15 additions & 0 deletions tests/integration-tests/nose_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ def test_docstrings(venv):
])


def test_skip(venv):
# Note: skip reason is unavailable, see https://groups.google.com/forum/#!topic/nose-users/MnPwgZG8UbQ

output = run(venv, 'skiptest')
assert_service_messages(
output,
[
ServiceMessage('testSuiteStarted', {'name': 'testa'}),
ServiceMessage('testStarted', {'name': 'test_func'}),
ServiceMessage('testIgnored', {'name': 'test_func', 'message': 'Skipped'}),
ServiceMessage('testFinished', {'name': 'test_func'}),
ServiceMessage('testSuiteFinished', {'name': 'testa'}),
])


def test_pass(venv):
output = run(venv, 'nose-guinea-pig.py', 'GuineaPig', 'test_pass')
assert_service_messages(
Expand Down

0 comments on commit 034371a

Please sign in to comment.