コード例 #1
0
ファイル: test_tools.py プロジェクト: robmadole/jig
 def test_indents_different_by(self):
     """
     Can change the default indent of 4 to a different integer.
     """
     self.assertEqual(
         [u' a', u' b', u' c'],
         indent(['a', 'b', 'c'], by=1))
コード例 #2
0
ファイル: test_tools.py プロジェクト: robmadole/jig
 def test_indents_different_character(self):
     """
     Can change the character used to indent to something else.
     """
     self.assertEqual(
         [u'?a', u'?b', u'?c'],
         indent(['a', 'b', 'c'], by=1, character='?'))
コード例 #3
0
ファイル: test_tools.py プロジェクト: robmadole/jig
 def test_indents_list(self):
     """
     List payload indents each item and returns a list.
     """
     self.assertEqual(
         [u'    a', u'    b', u'    c'],
         indent(['a', 'b', 'c']))
コード例 #4
0
ファイル: plugin.py プロジェクト: robmadole/jig
    def update(self, argv):
        """
        Updates any plugins installed through a URL.

        This basically runs ``git pull`` within any directory inside the
        :file:`.jig/plugis` directory. It's a very simple method of updating
        plugins that have already been installed.
        """
        path = argv.path

        with self.out() as out:
            # Make sure that this directory has been initialized for Jig
            get_jigconfig(path)

            results = update_plugins(path)

            if not results:
                out.append('No plugins to update.')
                return

            out.append('Updating plugins')
            out.append('')

            for pm, output in results.items():
                names = set([i.name for i in pm.plugins])
                bundles = set([i.bundle for i in pm.plugins])

                out.append('Plugin {0} in bundle {1}'.format(
                    ', '.join(names), ', '.join(bundles)))
                out.extend(indent(output.splitlines()))
コード例 #5
0
ファイル: testrunner.py プロジェクト: robmadole/jig
    def _add_verbosity(self, out, stdin, stdout):
        """
        Formats the stdin and stdout into the output.
        """
        # Try to pretty print our data if it's JSON
        data = [stdin, stdout]
        for i in (0, 1):
            try:
                obj = json.loads(data[i])
                data[i] = json.dumps(obj, indent=2)
            except ValueError:
                # Wasn't JSON
                pass
            data[i] = indent(data[i].splitlines())

        out.append(u'stdin (sent to the plugin)')
        out.append(u'')
        out.extend(data[0])
        out.append(u'')
        out.append(u'stdout (received from the plugin)')
        out.append(u'')
        out.extend(data[1])
        out.append(u'')
        out.append(REPORTER_HORIZONTAL_DIVIDER)
コード例 #6
0
ファイル: testrunner.py プロジェクト: dmore/jig
    def _add_verbosity(self, out, stdin, stdout):
        """
        Formats the stdin and stdout into the output.
        """
        # Try to pretty print our data if it's JSON
        data = [stdin, stdout]
        for i in (0, 1):
            try:
                obj = json.loads(data[i])
                data[i] = json.dumps(obj, indent=2)
            except ValueError:
                # Wasn't JSON
                pass
            data[i] = indent(data[i].splitlines())

        out.append(u'stdin (sent to the plugin)')
        out.append(u'')
        out.extend(data[0])
        out.append(u'')
        out.append(u'stdout (received from the plugin)')
        out.append(u'')
        out.extend(data[1])
        out.append(u'')
        out.append(REPORTER_HORIZONTAL_DIVIDER)
コード例 #7
0
ファイル: test_tools.py プロジェクト: robmadole/jig
 def test_indent_string(self):
     """
     If the payload is a string it indents and returns a string.
     """
     self.assertEqual('    a', indent('a'))