Ejemplo n.º 1
0
 def test_saved_password(self):
     self.write_file(self.rc, PYPIRC_NOPASSWORD)
     dist = Distribution()
     cmd = upload(dist)
     cmd.finalize_options()
     self.assertEqual(cmd.password, None)
     dist.password = '******'
     cmd = upload(dist)
     cmd.finalize_options()
     self.assertEqual(cmd.password, 'xxx')
Ejemplo n.º 2
0
 def test_saved_password(self):
     self.write_file(self.rc, PYPIRC_NOPASSWORD)
     dist = Distribution()
     cmd = upload(dist)
     cmd.finalize_options()
     self.assertEqual(cmd.password, None)
     dist.password = '******'
     cmd = upload(dist)
     cmd.finalize_options()
     self.assertEqual(cmd.password, 'xxx')
     return
Ejemplo n.º 3
0
def process_dist(dist):
    if dist.suffix == "zip":
        return

    d = {}
    for k in config.options('dist'):
        d[k] = config.get('dist', k)


    d['version'] = dist.cbrel.relvers

    print "Release:", dist.cbrel.relvers

    if d['classifiers']:
        d['classifiers'] = [x for x in d['classifiers'].split('\n') if x]

    c = upload(Distribution(d))
    c.repository = config.get('pypi', 'repository')
    c.username = config.get('pypi', 'username')
    c.password = config.get('pypi', 'password')

    if dist.already_uploaded(c.repository):
        print "Already uploaded.."
        return

    dist.prepare_upload()
    c.upload_file('bdist_wininst', dist.cbrel.pyvers, dist.symlink)
Ejemplo n.º 4
0
    def test_saved_password(self):
        # file with no password
        self.write_file(self.rc, PYPIRC_NOPASSWORD)

        # make sure it passes
        dist = Distribution()
        cmd = upload(dist)
        cmd.finalize_options()
        self.assertEqual(cmd.password, None)

        # make sure we get it as well, if another command
        # initialized it at the dist level
        dist.password = '******'
        cmd = upload(dist)
        cmd.finalize_options()
        self.assertEqual(cmd.password, 'xxx')
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files, author=u'dédé')
        cmd = upload(dist)
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        self.assertIn('dédé', self.last_open.req.data)
        headers = dict(self.last_open.req.headers)
        self.assertEquals(headers['Content-length'], '2085')
        self.assertTrue(
            headers['Content-type'].startswith('multipart/form-data'))
        self.assertEquals(self.last_open.req.get_method(), 'POST')
        self.assertEquals(self.last_open.req.get_full_url(),
                          'http://pypi.python.org/pypi')
        self.assertTrue('xxx' in self.last_open.req.data)
        auth = self.last_open.req.headers['Authorization']
        self.assertFalse('\n' in auth)
Ejemplo n.º 6
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files, author=u'dédé')
        cmd = upload(dist)
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        self.assertIn('dédé', self.last_open.req.data)
        headers = dict(self.last_open.req.headers)
        self.assertEqual(headers['Content-length'], '2085')
        self.assertTrue(headers['Content-type'].startswith('multipart/form-data'))
        self.assertEqual(self.last_open.req.get_method(), 'POST')
        self.assertEqual(self.last_open.req.get_full_url(),
                         'https://pypi.python.org/pypi')
        self.assertIn('xxx', self.last_open.req.data)
        auth = self.last_open.req.headers['Authorization']
        self.assertNotIn('\n', auth)
Ejemplo n.º 7
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.show_response = 1
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        headers = dict(self.last_open.req.headers)
        self.assertEqual(headers['Content-length'], '2161')
        content_type = headers['Content-type']
        self.assertTrue(content_type.startswith('multipart/form-data'))
        self.assertEqual(self.last_open.req.get_method(), 'POST')
        expected_url = 'https://pypi.python.org/pypi'
        self.assertEqual(self.last_open.req.get_full_url(), expected_url)
        self.assertTrue(b'xxx' in self.last_open.req.data)

        # The PyPI response body was echoed
        results = self.get_logs(INFO)
        self.assertIn('xyzzy\n', results[-1])
Ejemplo n.º 8
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        res = _CONNECTIONS[-1]

        headers = res.headers
        self.assertEquals(headers['Content-length'], '2086')
        self.assertTrue(
            headers['Content-type'].startswith('multipart/form-data'))

        method, request = res.requests[-1]
        self.assertEquals(method, 'POST')
        self.assertEquals(res.netloc, 'pypi.python.org')
        self.assertTrue('xxx' in res.body)
        self.assertFalse('\n' in headers['Authorization'])
Ejemplo n.º 9
0
    def test_saved_password(self):
        # file with no password
        self.write_file(self.rc, PYPIRC_NOPASSWORD)

        # make sure it passes
        dist = Distribution()
        cmd = upload(dist)
        cmd.finalize_options()
        self.assertEqual(cmd.password, None)

        # make sure we get it as well, if another command
        # initialized it at the dist level
        dist.password = '******'
        cmd = upload(dist)
        cmd.finalize_options()
        self.assertEqual(cmd.password, 'xxx')
Ejemplo n.º 10
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.show_response = 1
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        headers = dict(self.last_open.req.headers)
        self.assertEqual(headers['Content-length'], '2161')
        content_type = headers['Content-type']
        self.assertTrue(content_type.startswith('multipart/form-data'))
        self.assertEqual(self.last_open.req.get_method(), 'POST')
        expected_url = 'https://pypi.python.org/pypi'
        self.assertEqual(self.last_open.req.get_full_url(), expected_url)
        self.assertTrue(b'xxx' in self.last_open.req.data)

        # The PyPI response body was echoed
        results = self.get_logs(INFO)
        self.assertIn('xyzzy\n', results[-1])
Ejemplo n.º 11
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        res = _CONNECTIONS[-1]

        headers = res.headers
        self.assertEquals(headers['Content-length'], '2086')
        self.assertTrue(headers['Content-type'].startswith('multipart/form-data'))

        method, request = res.requests[-1]
        self.assertEquals(method, 'POST')
        self.assertEquals(res.netloc, 'pypi.python.org')
        self.assertTrue('xxx' in res.body)
        self.assertFalse('\n' in headers['Authorization'])
Ejemplo n.º 12
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, "xxx")
        self.write_file(path)
        command, pyversion, filename = "xxx", "2.6", path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.show_response = 1
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        headers = dict(self.last_open.req.headers)
        self.assertEqual(headers["Content-length"], "2087")
        self.assertTrue(headers["Content-type"].startswith("multipart/form-data"))
        self.assertEqual(self.last_open.req.get_method(), "POST")
        self.assertEqual(self.last_open.req.get_full_url(), "https://pypi.python.org/pypi")
        self.assertIn(b"xxx", self.last_open.req.data)

        # The PyPI response body was echoed
        results = self.get_logs(INFO)
        self.assertIn("xyzzy\n", results[-1])
Ejemplo n.º 13
0
 def test_finalize_options(self):
     self.write_file(self.rc, PYPIRC)
     dist = Distribution()
     cmd = upload(dist)
     cmd.finalize_options()
     for attr, waited in (('username', 'me'), ('password', 'secret'), (
         'realm', 'pypi'), ('repository', 'https://upload.pypi.org/legacy/')
         ):
         self.assertEqual(getattr(cmd, attr), waited)
Ejemplo n.º 14
0
 def test_finalize_options(self):
     self.write_file(self.rc, PYPIRC)
     dist = Distribution()
     cmd = upload(dist)
     cmd.finalize_options()
     for attr, waited in (('username', 'me'),
      ('password', 'secret'),
      ('realm', 'pypi'),
      ('repository', 'https://pypi.python.org/pypi')):
         self.assertEqual(getattr(cmd, attr), waited)
Ejemplo n.º 15
0
 def test_finalize_options(self):
     self.write_file(self.rc, PYPIRC)
     dist = Distribution()
     cmd = upload(dist)
     cmd.finalize_options()
     for attr, waited in (
         ("username", "me"),
         ("password", "secret"),
         ("realm", "pypi"),
         ("repository", "https://pypi.python.org/pypi"),
     ):
         self.assertEqual(getattr(cmd, attr), waited)
Ejemplo n.º 16
0
 def bdist_dumb(self):
     #python setup.py sdist upload -r http://localhost:8000/ --show-response
     command = 'bdist_dumb'
     
     pyversion = 'any'
     self.distribution.dist_files.append((command,pyversion,self.filename))
     u = upload(self.distribution)
     u.username = self.username
     u.password = self.password
     u.repository = self.repository
     u.run()
     print '%s uploaded' %(self.filename)
Ejemplo n.º 17
0
def upload_egg(egg_file, repo):
    dist = _get_dist(egg_file)
    cfg = _get_pypi_cfg(egg_file, repo)

    up_cmd = upload.upload(dist)
    up_cmd.repository = cfg['repository']
    up_cmd.username = cfg['username']
    up_cmd.password = cfg['password']

    get_log().info("Uploading {} to {}".format(egg_file, cfg['repository']))

    up_cmd.upload_file('bdist_egg', get_python_version(), egg_file)
Ejemplo n.º 18
0
    def bdist_dumb(self):
        #python setup.py sdist upload -r http://localhost:8000/ --show-response
        command = 'bdist_dumb'

        pyversion = 'any'
        self.distribution.dist_files.append(
            (command, pyversion, self.filename))
        u = upload(self.distribution)
        u.username = self.username
        u.password = self.password
        u.repository = self.repository
        u.run()
        print '%s uploaded' % (self.filename)
Ejemplo n.º 19
0
    def test_finalize_options(self):

        # new format
        f = open(self.rc, 'w')
        f.write(PYPIRC)
        f.close()

        dist = Distribution()
        cmd = upload(dist)
        cmd.finalize_options()
        for attr, waited in (('username', 'me'), ('password',
                                                  'secret'), ('realm', 'pypi'),
                             ('repository', 'http://pypi.python.org/pypi')):
            self.assertEquals(getattr(cmd, attr), waited)
Ejemplo n.º 20
0
    def test_finalize_options(self):

        # new format
        f = open(self.rc, 'w')
        f.write(PYPIRC)
        f.close()

        dist = Distribution()
        cmd = upload(dist)
        cmd.finalize_options()
        for attr, waited in (('username', 'me'), ('password', 'secret'),
                             ('realm', 'pypi'),
                             ('repository', 'http://pypi.python.org/pypi')):
            self.assertEquals(getattr(cmd, attr), waited)
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.show_response = 1
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        headers = dict(self.last_open.req.headers)
        self.assertGreaterEqual(int(headers['Content-length']), 2162)
        content_type = headers['Content-type']
        self.assertTrue(content_type.startswith('multipart/form-data'))
        self.assertEqual(self.last_open.req.get_method(), 'POST')
        expected_url = 'https://upload.pypi.org/legacy/'
        self.assertEqual(self.last_open.req.get_full_url(), expected_url)
        data = self.last_open.req.data
        self.assertIn(b'xxx',data)
        self.assertIn(b'protocol_version', data)
        self.assertIn(b'sha256_digest', data)
        self.assertIn(
            b'cd2eb0837c9b4c962c22d2ff8b5441b7b45805887f051d39bf133b583baf'
            b'6860',
            data
        )
        if b'md5_digest' in data:
            self.assertIn(b'f561aaf6ef0bf14d4208bb46a4ccb3ad', data)
        if b'blake2_256_digest' in data:
            self.assertIn(
                b'b6f289a27d4fe90da63c503bfe0a9b761a8f76bb86148565065f040be'
                b'6d1c3044cf7ded78ef800509bccb4b648e507d88dc6383d67642aadcc'
                b'ce443f1534330a',
                data
            )

        # The PyPI response body was echoed
        results = self.get_logs(INFO)
        self.assertEqual(results[-1], 75 * '-' + '\nxyzzy\n' + 75 * '-')
Ejemplo n.º 22
0
    def bdist_dumb(self):
        """Upload a binary distribution using the code version of:
        python setup.py sdist upload -r http://localhost:8000/ --show-response
        """
        command = 'bdist_dumb'
        
        pyversion = 'any'
        self.distribution.dist_files.append((command, pyversion, self.filename))
        distribution_upload = upload(self.distribution)
        distribution_upload.show_response = 1
        distribution_upload.username = self.username
        distribution_upload.password = self.password
        distribution_upload.repository = self.repository

        old_stdout = sys.stdout
        sys.stdout = mystdout = StringIO()
        
        distribution_upload.run()
        sys.stdout = old_stdout
        return mystdout.getvalue()
Ejemplo n.º 23
0
 def test_upload(self):
     tmp = self.mkdtemp()
     path = os.path.join(tmp, "xxx")
     self.write_file(path)
     command, pyversion, filename = "xxx", "2.6", path
     dist_files = [(command, pyversion, filename)]
     self.write_file(self.rc, PYPIRC_LONG_PASSWORD)
     pkg_dir, dist = self.create_dist(dist_files=dist_files, author=u"d\xe9d\xe9")
     cmd = upload(dist)
     cmd.ensure_finalized()
     cmd.run()
     self.assertIn("d\xc3\xa9d\xc3\xa9", self.last_open.req.data)
     headers = dict(self.last_open.req.headers)
     self.assertEqual(headers["Content-length"], "2085")
     self.assertTrue(headers["Content-type"].startswith("multipart/form-data"))
     self.assertEqual(self.last_open.req.get_method(), "POST")
     self.assertEqual(self.last_open.req.get_full_url(), "https://pypi.python.org/pypi")
     self.assertIn("xxx", self.last_open.req.data)
     auth = self.last_open.req.headers["Authorization"]
     self.assertNotIn("\n", auth)
Ejemplo n.º 24
0
    def test_upload_correct_cr(self):
        # content that ends with \r should not be modified.
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path, content='yy\r')
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # other fields that ended with \r used to be modified, now are
        # preserved.
        pkg_dir, dist = self.create_dist(dist_files=dist_files,
                                         description='long description\r')
        cmd = upload(dist)
        cmd.show_response = 1
        cmd.ensure_finalized()
        cmd.run()

        headers = dict(self.last_open.req.headers)
        self.assertGreaterEqual(int(headers['Content-length']), 2172)
        self.assertIn(b'long description\r', self.last_open.req.data)
Ejemplo n.º 25
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        headers = dict(self.conn.headers)
        self.assertEquals(headers['Content-length'], '2087')
        self.assert_(headers['Content-type'].startswith('multipart/form-data'))

        self.assertEquals(self.conn.requests, [('POST', '/pypi')])
        self.assert_((b'xxx') in self.conn.body)
Ejemplo n.º 26
0
 def test_wrong_exception_order(self):
     tmp = self.mkdtemp()
     path = os.path.join(tmp, 'xxx')
     self.write_file(path)
     dist_files = [('xxx', '2.6', path)]
     self.write_file(self.rc, PYPIRC_LONG_PASSWORD)
     pkg_dir, dist = self.create_dist(dist_files=dist_files)
     tests = [(OSError('oserror'), 'oserror', OSError), (HTTPError('url',
         400, 'httperror', {}, None), 'Upload failed (400): httperror',
         DistutilsError)]
     for exception, expected, raised_exception in tests:
         with self.subTest(exception=type(exception).__name__):
             with mock.patch('distutils.command.upload.urlopen', new=
                 mock.Mock(side_effect=exception)):
                 with self.assertRaises(raised_exception):
                     cmd = upload(dist)
                     cmd.ensure_finalized()
                     cmd.run()
                 results = self.get_logs(ERROR)
                 self.assertIn(expected, results[-1])
                 self.clear_logs()
Ejemplo n.º 27
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        headers = dict(self.conn.headers)
        self.assertEqual(headers['Content-length'], '2087')
        self.assertTrue(headers['Content-type'].startswith('multipart/form-data'))
        self.assertFalse('\n' in headers['Authorization'])

        self.assertEqual(self.conn.requests, [('POST', '/pypi')])
        self.assertTrue((b'xxx') in self.conn.body)
Ejemplo n.º 28
0
    def test_upload(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC)

        # lets run it
        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        cmd = upload(dist)
        cmd.ensure_finalized()
        cmd.run()

        # what did we send ?
        headers = dict(self.last_open.req.headers)
        self.assertEquals(headers['Content-length'], '2086')
        self.assertTrue(headers['Content-type'].startswith('multipart/form-data'))
        self.assertEquals(self.last_open.req.get_method(), 'POST')
        self.assertEquals(self.last_open.req.get_full_url(),
                          'http://pypi.python.org/pypi')
        self.assertTrue('xxx' in self.last_open.req.data)
Ejemplo n.º 29
0
    def test_upload_correct_cr(self):
        # content that ends with \r should not be modified.
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path, content='yy\r')
        command, pyversion, filename = 'xxx', '2.6', path
        dist_files = [(command, pyversion, filename)]
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        # other fields that ended with \r used to be modified, now are
        # preserved.
        pkg_dir, dist = self.create_dist(
            dist_files=dist_files,
            description='long description\r'
        )
        cmd = upload(dist)
        cmd.show_response = 1
        cmd.ensure_finalized()
        cmd.run()

        headers = dict(self.last_open.req.headers)
        self.assertEqual(headers['Content-length'], '2172')
        self.assertIn(b'long description\r', self.last_open.req.data)
Ejemplo n.º 30
0
 def test_upload(self):
     tmp = self.mkdtemp()
     path = os.path.join(tmp, 'xxx')
     self.write_file(path)
     command, pyversion, filename = 'xxx', '2.6', path
     dist_files = [(command, pyversion, filename)]
     self.write_file(self.rc, PYPIRC_LONG_PASSWORD)
     pkg_dir, dist = self.create_dist(dist_files=dist_files)
     cmd = upload(dist)
     cmd.show_response = 1
     cmd.ensure_finalized()
     cmd.run()
     headers = dict(self.last_open.req.headers)
     self.assertEqual(headers['Content-length'], '2162')
     content_type = headers['Content-type']
     self.assertTrue(content_type.startswith('multipart/form-data'))
     self.assertEqual(self.last_open.req.get_method(), 'POST')
     expected_url = 'https://upload.pypi.org/legacy/'
     self.assertEqual(self.last_open.req.get_full_url(), expected_url)
     self.assertTrue(b'xxx' in self.last_open.req.data)
     self.assertIn(b'protocol_version', self.last_open.req.data)
     results = self.get_logs(INFO)
     self.assertEqual(results[-1], 75 * '-' + '\nxyzzy\n' + 75 * '-')
Ejemplo n.º 31
0
    def test_wrong_exception_order(self):
        tmp = self.mkdtemp()
        path = os.path.join(tmp, 'xxx')
        self.write_file(path)
        dist_files = [('xxx', '2.6', path)]  # command, pyversion, filename
        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)

        pkg_dir, dist = self.create_dist(dist_files=dist_files)
        tests = [
            (OSError('oserror'), 'oserror', OSError),
            (HTTPError('url', 400, 'httperror', {}, None),
             'Upload failed (400): httperror', DistutilsError),
        ]
        for exception, expected, raised_exception in tests:
            with self.subTest(exception=type(exception).__name__):
                with mock.patch('distutils.command.upload.urlopen',
                                new=mock.Mock(side_effect=exception)):
                    with self.assertRaises(raised_exception):
                        cmd = upload(dist)
                        cmd.ensure_finalized()
                        cmd.run()
                    results = self.get_logs(ERROR)
                    self.assertIn(expected, results[-1])
                    self.clear_logs()