1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/3de02d55a78f/ Changeset: 3de02d55a78f User: flub Date: 2013-10-01 14:20:20 Summary: Allow unicode strings in parser.add_argument()
This fixes issue360 by also converting unicode strings to the argparse syntax instead of just native strings. Affected #: 3 files diff -r aba49b1a860f2b5914770841d0410ae3e357ad75 -r 3de02d55a78f36b45982627b5ecb9825bb0d8ca2 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,8 @@ Changes between 2.4.0 and X ----------------------------------- - +- fix issue360: When using parser.addoption() unicode arguments to the + "type" keyword should also be converted to the respective types. Changes between 2.3.5 and 2.4 ----------------------------------- diff -r aba49b1a860f2b5914770841d0410ae3e357ad75 -r 3de02d55a78f36b45982627b5ecb9825bb0d8ca2 _pytest/config.py --- a/_pytest/config.py +++ b/_pytest/config.py @@ -238,7 +238,7 @@ pass else: # this might raise a keyerror as well, don't want to catch that - if isinstance(typ, str): + if isinstance(typ, py.builtin._basestring): if typ == 'choice': if self.TYPE_WARN: py.std.warnings.warn( diff -r aba49b1a860f2b5914770841d0410ae3e357ad75 -r 3de02d55a78f36b45982627b5ecb9825bb0d8ca2 testing/test_config.py --- a/testing/test_config.py +++ b/testing/test_config.py @@ -113,6 +113,17 @@ assert config.getoption(x) == "this" pytest.raises(ValueError, "config.getoption('qweqwe')") + @pytest.mark.skipif('sys.version_info[:2] not in [(2, 6), (2, 7)]') + def test_config_getoption_unicode(self, testdir): + testdir.makeconftest(""" + from __future__ import unicode_literals + + def pytest_addoption(parser): + parser.addoption('--hello', type='string') + """) + config = testdir.parseconfig('--hello=this') + assert config.getoption('hello') == 'this' + def test_config_getvalueorskip(self, testdir): config = testdir.parseconfig() pytest.raises(pytest.skip.Exception, Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit