fix some py33 issues introduced with rev 2985

--HG--
branch : argcomplete
This commit is contained in:
holger krekel 2013-08-01 14:24:25 +02:00
parent ef2ddb6f16
commit b90d82c17f
2 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ import py
import sys, os import sys, os
from _pytest.core import PluginManager from _pytest.core import PluginManager
import pytest import pytest
from _argcomplete import try_argcomplete, filescompleter from _pytest._argcomplete import try_argcomplete, filescompleter
# enable after some grace period for plugin writers # enable after some grace period for plugin writers
TYPE_WARN = False TYPE_WARN = False
@ -142,7 +142,7 @@ class Argument:
'int': int, 'int': int,
'string': str, 'string': str,
} }
def __init__(self, *names, **attrs): def __init__(self, *names, **attrs):
"""store parms in private vars for use in add_argument""" """store parms in private vars for use in add_argument"""
self._attrs = attrs self._attrs = attrs
@ -188,7 +188,7 @@ class Argument:
FutureWarning, FutureWarning,
stacklevel=3) stacklevel=3)
attrs['type'] = Argument._typ_map[typ] attrs['type'] = Argument._typ_map[typ]
# used in test_parseopt -> test_parse_defaultgetter # used in test_parseopt -> test_parse_defaultgetter
self.type = attrs['type'] self.type = attrs['type']
else: else:
self.type = typ self.type = typ
@ -227,7 +227,7 @@ class Argument:
#a = a.replace('%prog', '%(prog)s') #a = a.replace('%prog', '%(prog)s')
self._attrs['help'] = a self._attrs['help'] = a
return self._attrs return self._attrs
def _set_opt_strings(self, opts): def _set_opt_strings(self, opts):
"""directly from optparse """directly from optparse
@ -251,7 +251,7 @@ class Argument:
"must start with --, followed by non-dash" % opt, "must start with --, followed by non-dash" % opt,
self) self)
self._long_opts.append(opt) self._long_opts.append(opt)
def __repr__(self): def __repr__(self):
retval = 'Argument(' retval = 'Argument('
if self._short_opts: if self._short_opts:
@ -268,7 +268,7 @@ class Argument:
retval += ')' retval += ')'
return retval return retval
class OptionGroup: class OptionGroup:
def __init__(self, name, description="", parser=None): def __init__(self, name, description="", parser=None):
self.name = name self.name = name
@ -320,7 +320,7 @@ class MyOptionParser(py.std.argparse.ArgumentParser):
getattr(args, Config._file_or_dir).extend(argv) getattr(args, Config._file_or_dir).extend(argv)
return args return args
class Conftest(object): class Conftest(object):
""" the single place for accessing values and interacting """ the single place for accessing values and interacting
towards conftest modules from py.test objects. towards conftest modules from py.test objects.
@ -440,7 +440,7 @@ class CmdOptions(object):
class Config(object): class Config(object):
""" access to configuration values, pluginmanager and plugin hooks. """ """ access to configuration values, pluginmanager and plugin hooks. """
_file_or_dir = 'file_or_dir' _file_or_dir = 'file_or_dir'
def __init__(self, pluginmanager=None): def __init__(self, pluginmanager=None):
#: access to command line option as attributes. #: access to command line option as attributes.
#: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead #: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead

View File

@ -196,7 +196,7 @@ def test_argcomplete(testdir, monkeypatch):
monkeypatch.setenv('COMP_LINE', "py.test " + arg) monkeypatch.setenv('COMP_LINE', "py.test " + arg)
monkeypatch.setenv('COMP_POINT', str(len("py.test " + arg))) monkeypatch.setenv('COMP_POINT', str(len("py.test " + arg)))
result = testdir.run('bash', str(script), arg) result = testdir.run('bash', str(script), arg)
print dir(result), result.ret #print dir(result), result.ret
if result.ret == 255: if result.ret == 255:
# argcomplete not found # argcomplete not found
pytest.skip("argcomplete not available") pytest.skip("argcomplete not available")