1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/e2b3cb8add41/ changeset: e2b3cb8add41 user: flub date: 2013-02-15 12:47:48 summary: Allow MarkEvaluator expressions to be unicode
This fixes issue #266. affected #: 2 files diff -r 18234e3726bf090183d0cf7cc76c58ac89c179fb -r e2b3cb8add4138967f980de01ccaf99673cf8be7 _pytest/skipping.py --- a/_pytest/skipping.py +++ b/_pytest/skipping.py @@ -3,6 +3,12 @@ import py, pytest import sys +# Provide basestring in python3 +try: + basestring = basestring +except NameError: + basestring = str + def pytest_addoption(parser): group = parser.getgroup("general") group.addoption('--runxfail', @@ -86,7 +92,7 @@ self.result = False for expr in self.holder.args: self.expr = expr - if isinstance(expr, str): + if isinstance(expr, basestring): result = cached_eval(self.item.config, expr, d) else: pytest.fail("expression is not a string") diff -r 18234e3726bf090183d0cf7cc76c58ac89c179fb -r e2b3cb8add4138967f980de01ccaf99673cf8be7 testing/test_skipping.py --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -39,6 +39,20 @@ expl = ev.getexplanation() assert expl == "condition: hasattr(os, 'sep')" + @pytest.mark.skipif('sys.version_info[0] >= 3') + def test_marked_one_arg_unicode(self, testdir): + item = testdir.getitem(""" + import pytest + @pytest.mark.xyz(u"hasattr(os, 'sep')") + def test_func(): + pass + """) + ev = MarkEvaluator(item, 'xyz') + assert ev + assert ev.istrue() + expl = ev.getexplanation() + assert expl == "condition: hasattr(os, 'sep')" + def test_marked_one_arg_with_reason(self, testdir): item = testdir.getitem(""" import pytest 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 http://mail.python.org/mailman/listinfo/pytest-commit