Skip to content

Commit

Permalink
plugin-class-skipper (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
z00sts authored Feb 15, 2018
1 parent cdd9492 commit a65cfe5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.3

- Add XUnit plugin 'lode_runner.plugins.ClassSkipper'. Allows skip TestClasses with no setUpClass calls

## 0.4.2

- Skip 'nose.multiprocess' testcases dirung merging xml files
Expand Down
7 changes: 6 additions & 1 deletion lode_runner/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ def plugins():
from lode_runner.plugins.testid import TestId
from lode_runner.plugins.initializer import Initializer
from lode_runner.plugins.failer import Failer
from lode_runner.plugins.class_skipper import ClassSkipper

plugs = [
Dataprovider, Xunit, MultiProcess, TestId, Initializer, Failer
Dataprovider, Xunit, MultiProcess, TestId, Initializer, Failer, ClassSkipper
]

from nose.plugins import builtin
Expand Down Expand Up @@ -143,3 +144,7 @@ def run(*args, **kwargs):
except KeyError:
argv = ['run']
return LodeProgram(argv=argv, *args, **kwargs).success


if __name__ == "__main__":
main()
17 changes: 17 additions & 0 deletions lode_runner/plugins/class_skipper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# coding: utf-8

from nose.plugins import Plugin
from nose.exc import SkipTest


class ClassSkipper(Plugin):
name = 'class_skipper'
enabled = True

def configure(self, options, conf):
super(ClassSkipper, self).configure(options, conf)
self.enabled = True

def startContext(self, context):
if getattr(context, '__unittest_skip__', False):
raise SkipTest(getattr(context, '__unittest_skip_why__', 'Unknown skip reason'))
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
setup(
name='lode_runner',
url='https://github.com/2gis/lode_runner',
version='0.4.2',
version='0.4.3',
description='Nosetests runner plugins package',
long_description='',
author='Igor Pavlov',
Expand All @@ -25,7 +25,8 @@
'multiprocess = lode_runner.plugins.multiprocess:MultiProcess',
'testid = lode_runner.plugins.testid:TestId',
'initializer = lode_runner.plugins.initializer:Initializer',
'failer = lode_runner.plugins.failer:Failer'
'failer = lode_runner.plugins.failer:Failer',
'class_skipper = lode_runner.plugins.class_skipper:ClassSkipper'
]
},
classifiers=[
Expand Down

0 comments on commit a65cfe5

Please sign in to comment.