Ejemplo n.º 1
0
 def test_output_default(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut(
         '[versions]\n'
         'egg                             = 0.3\n')
Ejemplo n.º 2
0
 def test_output_with_plus_and_minus(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -vvv -qqq')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut(
         '[versions]\n'
         'egg                             = 0.3\n')
Ejemplo n.º 3
0
 def test_write_in_existing_file_with_exclude(self):
     config_file = NamedTemporaryFile()
     config_file.write(
         '[buildout]\ndevelop=.\n'
         '[versions]\nexcluded=1.0\negg=0.1'.encode('utf-8'))
     config_file.seek(0)
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline(
             '-e excluded -w %s' % config_file.name)
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         debug=['-> Last version of egg is 0.3.',
                '=> egg current version (0.1) and '
                'last version (0.3) are different.'],
         info=['- 2 versions found in %s.' % config_file.name,
               '- 1 packages need to be checked for updates.',
               '> Fetching latest datas for egg...',
               '- 1 package updates found.',
               '- %s updated.' % config_file.name],
         warning=['[versions]',
                  'egg                             = 0.3'])
     config_file.seek(0)
     self.assertEquals(
         config_file.read().decode('utf-8'),
         '[buildout]\n'
         'develop                         = .\n\n'
         '[versions]\n'
         'excluded                        = 1.0\n'
         'egg                             = 0.3\n')
     self.assertStdOut(
         '[versions]\n'
         'egg                             = 0.3\n')
Ejemplo n.º 4
0
 def test_write_in_existing_file_with_exclude(self):
     config_file = NamedTemporaryFile()
     config_file.write('[buildout]\ndevelop=.\n'
                       '[versions]\nexcluded=1.0\negg=0.1'.encode('utf-8'))
     config_file.seek(0)
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-e excluded -w %s' %
                                        config_file.name)
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         debug=[
             '-> Last version of egg is 0.3.',
             '=> egg current version (0.1) and '
             'last version (0.3) are different.'
         ],
         info=[
             '- 2 versions found in %s.' % config_file.name,
             '- 1 packages need to be checked for updates.',
             '> Fetching latest datas for egg...',
             '- 1 package updates found.',
             '- %s updated.' % config_file.name
         ],
         warning=['[versions]', 'egg                             = 0.3'])
     config_file.seek(0)
     self.assertEquals(
         config_file.read().decode('utf-8'), '[buildout]\n'
         'develop                         = .\n\n'
         '[versions]\n'
         'excluded                        = 1.0\n'
         'egg                             = 0.3\n')
     self.assertStdOut('[versions]\n'
                       'egg                             = 0.3\n')
Ejemplo n.º 5
0
 def test_output_none(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -q')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -qqqqqqqq')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
Ejemplo n.º 6
0
 def test_output_none(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -q')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -qqqqqqqq')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('')
Ejemplo n.º 7
0
 def test_include_exclude(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i unavailable -e unavailable')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         debug=["'versions' section not found in versions.cfg."],
         info=['- 0 packages need to be checked for updates.',
               '- 0 package updates found.'])
     self.assertStdOut('')
Ejemplo n.º 8
0
 def test_output_increased(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -v')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('- 1 packages need to be checked for updates.\n'
                       '> Fetching latest datas for egg...\n'
                       '- 1 package updates found.\n'
                       '[versions]\n'
                       'egg                             = 0.3\n')
Ejemplo n.º 9
0
 def test_output_increased(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -v')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut(
         '- 1 packages need to be checked for updates.\n'
         '> Fetching latest datas for egg...\n'
         '- 1 package updates found.\n'
         '[versions]\n'
         'egg                             = 0.3\n')
Ejemplo n.º 10
0
 def test_write_include_in_blank(self):
     config_file = NamedTemporaryFile()
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -w %s' % config_file.name)
     self.assertEqual(context.exception.code, 0)
     config_file.seek(0)
     self.assertEquals(
         config_file.read().decode('utf-8'),
         '[versions]\negg                             = 0.3\n')
     self.assertStdOut(
         '[versions]\negg                             = 0.3\n')
Ejemplo n.º 11
0
 def test_include_exclude(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i unavailable -e unavailable')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         debug=["'versions' section not found in versions.cfg."],
         info=[
             '- 0 packages need to be checked for updates.',
             '- 0 package updates found.'
         ])
     self.assertStdOut('')
Ejemplo n.º 12
0
 def test_include_unavailable(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i unavailable')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         debug=["'versions' section not found in versions.cfg.",
                '!> http://pypi.python.org/pypi/unavailable/json 404',
                '-> Last version of unavailable is 0.0.0.'],
         info=['- 1 packages need to be checked for updates.',
               '> Fetching latest datas for unavailable...',
               '- 0 package updates found.'])
     self.assertStdOut('')
Ejemplo n.º 13
0
    def test_specifiers_errors(self):
        with self.assertRaises(SystemExit) as context:
            check_buildout_updates.cmdline('-i egg -s egg<0.3')
        self.assertEqual(context.exception.code, 2)
        self.assertInStdOut('error: argument -s/--specifier: '
                            'key:value syntax not followed')

        with self.assertRaises(SystemExit) as context:
            check_buildout_updates.cmdline('-i egg -s egg:')
        self.assertEqual(context.exception.code, 2)
        self.assertInStdOut('error: argument -s/--specifier: '
                            'key or value are empty')
Ejemplo n.º 14
0
    def test_specifiers_errors(self):
        with self.assertRaises(SystemExit) as context:
            check_buildout_updates.cmdline('-i egg -s egg<0.3')
        self.assertEqual(context.exception.code, 2)
        self.assertInStdOut('error: argument -s/--specifier: '
                            'key:value syntax not followed')

        with self.assertRaises(SystemExit) as context:
            check_buildout_updates.cmdline('-i egg -s egg:')
        self.assertEqual(context.exception.code, 2)
        self.assertInStdOut('error: argument -s/--specifier: '
                            'key or value are empty')
Ejemplo n.º 15
0
 def test_write_include_in_blank(self):
     config_file = NamedTemporaryFile()
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline(
             '-i egg -w %s' % config_file.name)
     self.assertEqual(context.exception.code, 0)
     config_file.seek(0)
     self.assertEquals(
         config_file.read().decode('utf-8'),
         '[versions]\negg                             = 0.3\n')
     self.assertStdOut(
         '[versions]\negg                             = 0.3\n')
Ejemplo n.º 16
0
 def test_output_max_specifiers(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -s egg:<0.3 -vvv')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut("'versions' section not found in versions.cfg.\n"
                       "- 1 packages need to be checked for updates.\n"
                       "> Fetching latest datas for egg...\n"
                       "-> Last version of egg<0.3 is 0.2.\n"
                       "=> egg current version (0.0.0) and "
                       "last version (0.2) are different.\n"
                       "- 1 package updates found.\n"
                       "[versions]\n"
                       "egg                             = 0.2\n")
Ejemplo n.º 17
0
 def test_output_max_specifiers(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -s egg:<0.3 -vvv')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut(
         "'versions' section not found in versions.cfg.\n"
         "- 1 packages need to be checked for updates.\n"
         "> Fetching latest datas for egg...\n"
         "-> Last version of egg<0.3 is 0.2.\n"
         "=> egg current version (0.0.0) and "
         "last version (0.2) are different.\n"
         "- 1 package updates found.\n"
         "[versions]\n"
         "egg                             = 0.2\n")
Ejemplo n.º 18
0
 def test_include_unavailable(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i unavailable')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(debug=[
         "'versions' section not found in versions.cfg.",
         '!> http://pypi.python.org/pypi/unavailable/json 404',
         '-> Last version of unavailable is 0.0.0.'
     ],
                     info=[
                         '- 1 packages need to be checked for updates.',
                         '> Fetching latest datas for unavailable...',
                         '- 0 package updates found.'
                     ])
     self.assertStdOut('')
Ejemplo n.º 19
0
 def test_include_no_source(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         debug=["'versions' section not found in versions.cfg.",
                '-> Last version of egg is 0.3.',
                '=> egg current version (0.0.0) and '
                'last version (0.3) are different.'],
         info=['- 1 packages need to be checked for updates.',
               '> Fetching latest datas for egg...',
               '- 1 package updates found.'],
         warning=['[versions]',
                  'egg                             = 0.3'])
     self.assertStdOut(
         '[versions]\n'
         'egg                             = 0.3\n')
Ejemplo n.º 20
0
 def test_include_no_source(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg')
     self.assertEqual(context.exception.code, 0)
     self.assertLogs(
         debug=[
             "'versions' section not found in versions.cfg.",
             '-> Last version of egg is 0.3.',
             '=> egg current version (0.0.0) and '
             'last version (0.3) are different.'
         ],
         info=[
             '- 1 packages need to be checked for updates.',
             '> Fetching latest datas for egg...',
             '- 1 package updates found.'
         ],
         warning=['[versions]', 'egg                             = 0.3'])
     self.assertStdOut('[versions]\n'
                       'egg                             = 0.3\n')
Ejemplo n.º 21
0
"""Buildout Versions Checker"""
from bvc.checker import VersionsChecker
from bvc.configparser import VersionsConfigParser
from bvc.scripts.check_buildout_updates import cmdline

__all__ = [VersionsChecker.__name__, VersionsConfigParser.__name__]

if __name__ == '__main__':
    cmdline()  # pragma: no cover
Ejemplo n.º 22
0
 def test_handle_error(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i error-egg')
     self.assertEqual(context.exception.code,
                      "list indices must be integers, not str")
Ejemplo n.º 23
0
 def test_output_default(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('[versions]\n'
                       'egg                             = 0.3\n')
Ejemplo n.º 24
0
 def test_handle_error(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i error-egg')
     self.assertEqual(context.exception.code,
                      "list indices must be integers, not str")
Ejemplo n.º 25
0
 def test_output_with_plus_and_minus(self):
     with self.assertRaises(SystemExit) as context:
         check_buildout_updates.cmdline('-i egg -vvv -qqq')
     self.assertEqual(context.exception.code, 0)
     self.assertStdOut('[versions]\n'
                       'egg                             = 0.3\n')