Skip to content

Commit

Permalink
Bugfix - unsupported ArgumentParser kwarg "copystr" no longer passed …
Browse files Browse the repository at this point in the history
…to super() method
  • Loading branch information
opspacks-staging committed Apr 24, 2019
1 parent f05bb8d commit 27d6c1d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.1
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: plugnpy
version: 1.0.0
version: 1.1.1

source:
path: ..
Expand Down
2 changes: 1 addition & 1 deletion plugnpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""plugnpy - A Simple Python Library for creating Opsview Opspack plugins"""

__version__ = '1.0.0'
__version__ = '1.1.1'
__release__ = '1'
__program_name__ = 'plugnpy'

Expand Down
5 changes: 4 additions & 1 deletion plugnpy/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class Parser(ArgumentParser):
"""

def __init__(self, *args, **kwargs):
self._copyright = kwargs.get('copystr', None)
self._copyright = None
if 'copystr' in kwargs:
self._copyright = kwargs['copystr']
del kwargs['copystr']
super(Parser, self).__init__(*args, **kwargs)

def format_help(self):
Expand Down
6 changes: 6 additions & 0 deletions test/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import os
import sys

import pytest

from plugnpy.parser import Parser


def test_copyright(capsys):
parser = Parser(copystr='copyright string')
parser.print_help(sys.stdout)
assert 'copyright string' in capsys.readouterr().out

def test_customizations(capsys):
with pytest.raises(SystemExit) as e:
Parser().error('something')
Expand Down

0 comments on commit 27d6c1d

Please sign in to comment.