diff --git a/pubs/commands/add_cmd.py b/pubs/commands/add_cmd.py index 0ee13e8..a22c0a5 100644 --- a/pubs/commands/add_cmd.py +++ b/pubs/commands/add_cmd.py @@ -32,7 +32,7 @@ def parser(subparsers, conf): default=None ).completer = CommaSeparatedTagsCompletion(conf) parser.add_argument('-k', '--citekey', help='citekey associated with the paper;\nif not provided, one will be generated automatically.', - default=None, type=p3.to_utf8) + default=None, type=p3.u_maybe) parser.add_argument('-L', '--link', action='store_false', dest='copy', default=True, help="don't copy document files, just create a link.") parser.add_argument('-M', '--move', action='store_true', dest='move', default=False, diff --git a/pubs/commands/remove_cmd.py b/pubs/commands/remove_cmd.py index ed8e23c..0b7f9e0 100644 --- a/pubs/commands/remove_cmd.py +++ b/pubs/commands/remove_cmd.py @@ -4,7 +4,7 @@ from .. import repo from .. import color from ..uis import get_ui from ..utils import resolve_citekey_list -from ..p3 import ustr, to_utf8 +from ..p3 import ustr, u_maybe from ..completion import CiteKeyCompletion @@ -12,7 +12,7 @@ def parser(subparsers, conf): parser = subparsers.add_parser('remove', help='removes a publication') parser.add_argument('-f', '--force', action='store_true', default=None, help="does not prompt for confirmation.") - parser.add_argument('citekeys', nargs='+', type=to_utf8, + parser.add_argument('citekeys', nargs='+', type=u_maybe, help="one or several citekeys", ).completer = CiteKeyCompletion(conf) return parser diff --git a/pubs/p3.py b/pubs/p3.py index 5e10e02..197d26f 100644 --- a/pubs/p3.py +++ b/pubs/p3.py @@ -52,9 +52,6 @@ if sys.version_info[0] == 2: stdio.seek(0) return stdio.read() - def to_utf8(s): - return b(s) - # for details, see http://bugs.python.org/issue9779 class ArgumentParser(argparse.ArgumentParser): def _print_message(self, message, file=None): @@ -104,9 +101,6 @@ else: stdio.seek(0) return stdio.read() - def to_utf8(s): - return s - import pickle ArgumentParser = argparse.ArgumentParser diff --git a/pubs/version.py b/pubs/version.py index 1ffac67..6043ce8 100644 --- a/pubs/version.py +++ b/pubs/version.py @@ -1 +1 @@ -__version__ = '0.8.dev1' +__version__ = '0.8.dev2' diff --git a/tests/test_usecase.py b/tests/test_usecase.py index a59a773..7d98492 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -123,9 +123,7 @@ class CommandTestCase(fake_env.TestFakeFs): actual_err = color.undye(stderr) if expected_out is not None: self.assertEqual(p3.u_maybe(actual_out), p3.u_maybe(expected_out)) - #self.assertEqual(actual_out, expected_out) if expected_err is not None: - self.assertEqual(actual_err, expected_err) self.assertEqual(p3.u_maybe(actual_err), p3.u_maybe(expected_err)) outs.append(color.undye(actual_out)) else: @@ -201,11 +199,6 @@ class TestAlone(CommandTestCase): self.execute_cmds(['pubs']) self.assertEqual(cm.exception.code, 2) -<<<<<<< HEAD -======= - - @unittest.skipIf(sys.version_info.major == 2, "not supported for Python2") ->>>>>>> implement requested changes for #133 def test_alone_prints_help(self): # capturing the output of `pubs --help` is difficult because argparse # raises as SystemExit(0) after calling `print_help`, and this gets