Example #1
0
 def test_check_hooks(self):
     pkg_info, dist = self.create_dist()
     dist.command_options['install_dist'] = {
         'pre_hook': ('file', {"a": 'some.nonextistant.hook.ghrrraarrhll'}),
     }
     cmd = check(dist)
     cmd.check_hooks_resolvable()
     self.assertEqual(len(self.get_logs()), 1)
Example #2
0
 def test_warn(self):
     _, dist = self.create_dist()
     cmd = check(dist)
     self.assertEqual(self.get_logs(), [])
     cmd.warn('hello')
     self.assertEqual(self.get_logs(), ['check: hello'])
     cmd.warn('hello %s', 'world')
     self.assertEqual(self.get_logs(), ['check: hello world'])
     cmd.warn('hello %s %s', 'beautiful', 'world')
     self.assertEqual(self.get_logs(), ['check: hello beautiful world'])
Example #3
0
 def _run(self, metadata=None, **options):
     if metadata is None:
         metadata = {'name': 'xxx', 'version': '1.2'}
     pkg_info, dist = self.create_dist(**metadata)
     cmd = check(dist)
     cmd.initialize_options()
     for name, value in options.items():
         setattr(cmd, name, value)
     cmd.ensure_finalized()
     cmd.run()
     return cmd
Example #4
0
    def test_check_restructuredtext(self):
        # let's see if it detects broken rest in description
        broken_rest = 'title\n===\n\ntest'
        pkg_info, dist = self.create_dist(description=broken_rest)
        cmd = check(dist)
        cmd.check_restructuredtext()
        self.assertEqual(len(self.get_logs()), 1)

        # let's see if we have an error with strict=1
        metadata = {'home_page': 'xxx', 'author': 'xxx',
                    'author_email': 'xxx',
                    'name': 'xxx', 'version': '1.2',
                    'description': broken_rest}
        self.assertRaises(PackagingSetupError, self._run, metadata,
                          strict=True, all=True)
        self.loghandler.flush()

        # and non-broken rest, including a non-ASCII character to test #12114
        dist = self.create_dist(description='title\n=====\n\ntest \u00df')[1]
        cmd = check(dist)
        cmd.check_restructuredtext()
        self.assertEqual(self.get_logs(), [])