Skip to content

Define basestring in Python 3 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tap2junit/tap13.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
# Copyright 2013, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -17,11 +16,15 @@
#
# Author: Josef Skladanka <jskladan@redhat.com>

from __future__ import print_function
import re
import yamlish
import StringIO


try:
basestring
except NameError:
basestring = str

RE_VERSION = re.compile(r"^\s*TAP version 13\s*$")
RE_PLAN = re.compile(r"^\s*(?P<start>\d+)\.\.(?P<end>\d+)\s*(#\s*(?P<explanation>.*))?\s*$")
Expand Down Expand Up @@ -144,7 +147,7 @@ def _parse(self, source):


def parse(self, source):
if isinstance(source, (str, unicode)):
if isinstance(source, basestring):
self._parse(StringIO.StringIO(source))
elif hasattr(source, "__iter__"):
self._parse(source)
Expand Down