Exemple #1
0
    def test_get_command_config(self):
        """Test successful and unsuccessful module loading."""
        cmd_cfg, error_msg = get_command_config(
                'pyqi.interfaces.optparse.config', 'make_bash_completion')
        self.assertEqual(cmd_cfg,
                         pyqi.interfaces.optparse.config.make_bash_completion)
        self.assertEqual(error_msg, None)

        cmd_cfg, error_msg = get_command_config(
                'hopefully.nonexistent.python.module', 'umm',
                exit_on_failure=False)
        self.assertEqual(cmd_cfg, None)

        py2_err = 'No module named hopefully.nonexistent.python.module.umm'
        py3_err = "No module named 'hopefully'"
        if is_py2():
            self.assertEqual(error_msg, py2_err)
        else:
            self.assertEqual(error_msg, py3_err)
Exemple #2
0
    def test_get_command_config(self):
        """Test successful and unsuccessful module loading."""
        cmd_cfg, error_msg = get_command_config(
            'pyqi.interfaces.optparse.config', 'make_bash_completion')
        self.assertEqual(cmd_cfg,
                         pyqi.interfaces.optparse.config.make_bash_completion)
        self.assertEqual(error_msg, None)

        cmd_cfg, error_msg = get_command_config(
            'hopefully.nonexistent.python.module',
            'umm',
            exit_on_failure=False)
        self.assertEqual(cmd_cfg, None)

        py2_err = 'No module named hopefully.nonexistent.python.module.umm'
        py3_err = "No module named 'hopefully'"
        if is_py2():
            self.assertEqual(error_msg, py2_err)
        else:
            self.assertEqual(error_msg, py3_err)
Exemple #3
0
# Copyright (c) 2013, The BiPy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

__credits__ = ["Daniel McDonald", "Greg Caporaso", "Doug Wendel",
               "Jai Ram Rideout"]

import os
import sys

from pyqi.util import is_py2

if is_py2():
    from StringIO import StringIO
else:
    from io import StringIO

from shutil import rmtree
from tempfile import mkdtemp
from unittest import TestCase, main
from pyqi.core.interfaces.optparse.output_handler import (write_string,
        write_list_of_strings, print_list_of_strings)
from pyqi.core.exception import IncompetentDeveloperError

class OutputHandlerTests(TestCase):
    def setUp(self):
        self.output_dir = mkdtemp()
        self.fp = os.path.join(self.output_dir, 'test_file.txt')
Exemple #4
0
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

__credits__ = [
    "Daniel McDonald", "Greg Caporaso", "Doug Wendel", "Jai Ram Rideout"
]

import os
import sys

from pyqi.util import is_py2

if is_py2():
    from StringIO import StringIO
else:
    from io import StringIO

from shutil import rmtree
from tempfile import mkdtemp
from unittest import TestCase, main
from pyqi.core.interfaces.optparse.output_handler import (
    write_string, write_list_of_strings, print_list_of_strings)
from pyqi.core.exception import IncompetentDeveloperError


class OutputHandlerTests(TestCase):
    def setUp(self):
        self.output_dir = mkdtemp()