Blame tests/test_pagure_lib_task_mirror.py

Pierre-Yves Chibon 893d4f
# -*- coding: utf-8 -*-
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
"""
Pierre-Yves Chibon 893d4f
 (c) 2018 - Copyright Red Hat Inc
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
 Authors:
Pierre-Yves Chibon 893d4f
   Pierre-Yves Chibon <pingou@pingoured.fr></pingou@pingoured.fr>
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
"""
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
from __future__ import unicode_literals
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
import datetime
Pierre-Yves Chibon 893d4f
import os
Pierre-Yves Chibon 893d4f
import shutil
Pierre-Yves Chibon 893d4f
import sys
Pierre-Yves Chibon 893d4f
import tempfile
Pierre-Yves Chibon 893d4f
import time
Pierre-Yves Chibon 893d4f
import unittest
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
import pygit2
Pierre-Yves Chibon 893d4f
import six
Pierre-Yves Chibon 893d4f
from mock import patch, MagicMock, call
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
sys.path.insert(0, os.path.join(os.path.dirname(
Pierre-Yves Chibon 893d4f
    os.path.abspath(__file__)), '..'))
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
import pagure
Pierre-Yves Chibon 893d4f
import pagure.lib.git
Pierre-Yves Chibon 893d4f
import tests
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
import pagure.lib.tasks_mirror
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
class PagureLibTaskMirrortests(tests.Modeltests):
Pierre-Yves Chibon 893d4f
    """ Tests for pagure.lib.task_mirror """
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    maxDiff = None
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def setUp(self):
Pierre-Yves Chibon 893d4f
        """ Set up the environnment, ran before every tests. """
Pierre-Yves Chibon 893d4f
        super(PagureLibTaskMirrortests, self).setUp()
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        pagure.config.config['REQUESTS_FOLDER'] = None
Pierre-Yves Chibon 893d4f
        self.sshkeydir = os.path.join(self.path, 'sshkeys')
Pierre-Yves Chibon 893d4f
        pagure.config.config['MIRROR_SSHKEYS_FOLDER'] = self.sshkeydir
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        tests.create_projects(self.session)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def test_create_ssh_key(self):
Pierre-Yves Chibon 893d4f
        """ Test the _create_ssh_key method. """
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertFalse(os.path.exists(self.sshkeydir))
Pierre-Yves Chibon 893d4f
        os.mkdir(self.sshkeydir)
Pierre-Yves Chibon 893d4f
        self.assertEqual(sorted(os.listdir(self.sshkeydir)), [])
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        keyfile = os.path.join(self.sshkeydir, 'testkey')
Pierre-Yves Chibon 893d4f
        pagure.lib.tasks_mirror._create_ssh_key(keyfile)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)),
Pierre-Yves Chibon 893d4f
            [u'testkey', u'testkey.pub']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def test_setup_mirroring(self):
Pierre-Yves Chibon 893d4f
        """ Test the setup_mirroring method. """
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertFalse(os.path.exists(self.sshkeydir))
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # Install the plugin at the DB level
Pierre-Yves Chibon 893d4f
        plugin = pagure.lib.plugins.get_plugin('Mirroring')
Pierre-Yves Chibon 893d4f
        dbobj = plugin.db_object()
Pierre-Yves Chibon 893d4f
        dbobj.project_id = project.id
Pierre-Yves Chibon 893d4f
        self.session.add(dbobj)
Pierre-Yves Chibon 893d4f
        self.session.commit()
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        pagure.lib.tasks_mirror.setup_mirroring(
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)),
Pierre-Yves Chibon 893d4f
            [u'test', u'test.pub']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNotNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
        self.assertTrue(
Pierre-Yves Chibon 893d4f
            project.mirror_hook.public_key.startswith('ssh-rsa '))
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def test_setup_mirroring_ssh_folder_exists_wrong_permissions(self):
Pierre-Yves Chibon 893d4f
        """ Test the setup_mirroring method. """
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        os.makedirs(self.sshkeydir)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertEqual(sorted(os.listdir(self.sshkeydir)), [])
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # Install the plugin at the DB level
Pierre-Yves Chibon 893d4f
        plugin = pagure.lib.plugins.get_plugin('Mirroring')
Pierre-Yves Chibon 893d4f
        dbobj = plugin.db_object()
Pierre-Yves Chibon 893d4f
        dbobj.project_id = project.id
Pierre-Yves Chibon 893d4f
        self.session.add(dbobj)
Pierre-Yves Chibon 893d4f
        self.session.commit()
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        self.assertRaises(
Pierre-Yves Chibon 893d4f
            pagure.exceptions.PagureException,
Pierre-Yves Chibon 893d4f
            pagure.lib.tasks_mirror.setup_mirroring,
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.assertEqual(sorted(os.listdir(self.sshkeydir)), [])
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def test_setup_mirroring_ssh_folder_symlink(self):
Pierre-Yves Chibon 893d4f
        """ Test the setup_mirroring method. """
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        os.symlink(
Pierre-Yves Chibon 893d4f
            self.path,
Pierre-Yves Chibon 893d4f
            self.sshkeydir
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)),
Pierre-Yves Chibon 893d4f
            [u'attachments', u'config', u'forks', u'releases',
Pierre-Yves Chibon 893d4f
             u'remotes', u'repos', u'sshkeys']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # Install the plugin at the DB level
Pierre-Yves Chibon 893d4f
        plugin = pagure.lib.plugins.get_plugin('Mirroring')
Pierre-Yves Chibon 893d4f
        dbobj = plugin.db_object()
Pierre-Yves Chibon 893d4f
        dbobj.project_id = project.id
Pierre-Yves Chibon 893d4f
        self.session.add(dbobj)
Pierre-Yves Chibon 893d4f
        self.session.commit()
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        self.assertRaises(
Pierre-Yves Chibon 893d4f
            pagure.exceptions.PagureException,
Pierre-Yves Chibon 893d4f
            pagure.lib.tasks_mirror.setup_mirroring,
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)),
Pierre-Yves Chibon 893d4f
            [u'attachments', u'config', u'forks', u'releases',
Pierre-Yves Chibon 893d4f
             u'remotes', u'repos', u'sshkeys']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    @patch('os.getuid', MagicMock(return_value=450))
Pierre-Yves Chibon 893d4f
    def test_setup_mirroring_ssh_folder_owner(self):
Pierre-Yves Chibon 893d4f
        """ Test the setup_mirroring method. """
Pierre-Yves Chibon 893d4f
        os.makedirs(self.sshkeydir, mode=0o700)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertEqual(sorted(os.listdir(self.sshkeydir)), [])
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # Install the plugin at the DB level
Pierre-Yves Chibon 893d4f
        plugin = pagure.lib.plugins.get_plugin('Mirroring')
Pierre-Yves Chibon 893d4f
        dbobj = plugin.db_object()
Pierre-Yves Chibon 893d4f
        dbobj.project_id = project.id
Pierre-Yves Chibon 893d4f
        self.session.add(dbobj)
Pierre-Yves Chibon 893d4f
        self.session.commit()
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        self.assertRaises(
Pierre-Yves Chibon 893d4f
            pagure.exceptions.PagureException,
Pierre-Yves Chibon 893d4f
            pagure.lib.tasks_mirror.setup_mirroring,
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.assertEqual(sorted(os.listdir(self.sshkeydir)), [])
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
class PagureLibTaskMirrorSetuptests(tests.Modeltests):
Pierre-Yves Chibon 893d4f
    """ Tests for pagure.lib.task_mirror """
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    maxDiff = None
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def setUp(self):
Pierre-Yves Chibon 893d4f
        """ Set up the environnment, ran before every tests. """
Pierre-Yves Chibon 893d4f
        super(PagureLibTaskMirrorSetuptests, self).setUp()
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        pagure.config.config['REQUESTS_FOLDER'] = None
Pierre-Yves Chibon 893d4f
        self.sshkeydir = os.path.join(self.path, 'sshkeys')
Pierre-Yves Chibon 893d4f
        pagure.config.config['MIRROR_SSHKEYS_FOLDER'] = self.sshkeydir
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        tests.create_projects(self.session)
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # Install the plugin at the DB level
Pierre-Yves Chibon 893d4f
        plugin = pagure.lib.plugins.get_plugin('Mirroring')
Pierre-Yves Chibon 893d4f
        dbobj = plugin.db_object()
Pierre-Yves Chibon 893d4f
        dbobj.target = 'ssh://user@localhost.localdomain/foobar.git'
Pierre-Yves Chibon 893d4f
        dbobj.project_id = project.id
Pierre-Yves Chibon 893d4f
        self.session.add(dbobj)
Pierre-Yves Chibon 893d4f
        self.session.commit()
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        pagure.lib.tasks_mirror.setup_mirroring(
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def test_setup_mirroring_twice(self):
Pierre-Yves Chibon 893d4f
        """ Test the setup_mirroring method. """
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)), [u'test', u'test.pub']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNotNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
        before_key = project.mirror_hook.public_key
Pierre-Yves Chibon 893d4f
        self.assertTrue(
Pierre-Yves Chibon 893d4f
            project.mirror_hook.public_key.startswith('ssh-rsa '))
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        self.assertRaises(
Pierre-Yves Chibon 893d4f
            pagure.exceptions.PagureException,
Pierre-Yves Chibon 893d4f
            pagure.lib.tasks_mirror.setup_mirroring,
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)),
Pierre-Yves Chibon 893d4f
            [u'test', u'test.pub']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNotNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
        self.assertEqual(project.mirror_hook.public_key, before_key)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    def test_teardown_mirroring(self):
Pierre-Yves Chibon 893d4f
        """ Test the teardown_mirroring method. """
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)), [u'test', u'test.pub']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNotNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
        self.assertTrue(
Pierre-Yves Chibon 893d4f
            project.mirror_hook.public_key.startswith('ssh-rsa '))
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        pagure.lib.tasks_mirror.teardown_mirroring(
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.session = pagure.lib.create_session(self.dbpath)
Pierre-Yves Chibon 893d4f
        self.assertEqual(sorted(os.listdir(self.sshkeydir)), [])
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
    @patch('pagure.lib.git.read_git_lines')
Pierre-Yves Chibon 893d4f
    def test_mirror_project(self,rgl):
Pierre-Yves Chibon 893d4f
        """ Test the mirror_project method. """
Pierre-Yves Chibon 893d4f
        rgl.return_value = ('stdout', 'stderr')
Pierre-Yves Chibon 893d4f
        tests.create_projects_git(
Pierre-Yves Chibon 893d4f
            os.path.join(self.path, 'repos'), bare=True)
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # before
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)), [u'test', u'test.pub']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNotNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
        self.assertTrue(
Pierre-Yves Chibon 893d4f
            project.mirror_hook.public_key.startswith('ssh-rsa '))
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        pagure.lib.tasks_mirror.mirror_project(
Pierre-Yves Chibon 893d4f
            username=None,
Pierre-Yves Chibon 893d4f
            namespace=None,
Pierre-Yves Chibon 893d4f
            name='test')
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
        # after
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            sorted(os.listdir(self.sshkeydir)),
Pierre-Yves Chibon 893d4f
            [u'test', u'test.pub']
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
        project = pagure.lib.get_authorized_project(self.session, 'test')
Pierre-Yves Chibon 893d4f
        self.assertIsNotNone(project.mirror_hook.public_key)
Pierre-Yves Chibon 893d4f
        self.assertTrue(
Pierre-Yves Chibon 893d4f
            project.mirror_hook.public_key.startswith('ssh-rsa '))
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 605eaa
        ssh_script = os.path.abspath(os.path.join(
Pierre-Yves Chibon 605eaa
            os.path.dirname(os.path.abspath(__file__)),
Pierre-Yves Chibon 605eaa
            '..', 'pagure','lib', 'ssh_script.sh'))
Pierre-Yves Chibon 605eaa
Pierre-Yves Chibon 893d4f
        calls = [
Pierre-Yves Chibon 893d4f
            call(
Pierre-Yves Chibon 605eaa
                [u'push', u'--mirror', u'ssh://user@localhost.localdomain/foobar.git'],
Pierre-Yves Chibon 605eaa
                abspath=os.path.join(self.path, 'repos', 'test.git'),
Pierre-Yves Chibon 893d4f
                env={
Pierre-Yves Chibon 605eaa
                    u'GIT_SSH': ssh_script,
Pierre-Yves Chibon 605eaa
                    u'SSHKEY': u'%s/sshkeys/test' % self.path
Pierre-Yves Chibon 893d4f
                },
Pierre-Yves Chibon 893d4f
                error=True
Pierre-Yves Chibon 893d4f
            )
Pierre-Yves Chibon 893d4f
        ]
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 605eaa
        self.assertEqual(rgl.call_count, 1)
Pierre-Yves Chibon 893d4f
        self.assertEqual(
Pierre-Yves Chibon 893d4f
            calls,
Pierre-Yves Chibon 893d4f
            rgl.mock_calls
Pierre-Yves Chibon 893d4f
        )
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
Pierre-Yves Chibon 893d4f
if __name__ == '__main__':
Pierre-Yves Chibon 893d4f
    unittest.main(verbosity=2)