def test_version_unknown(self, mock_popeno): mock_popeno().communicate.return_value = (b'No version specified\n', b'') with self.assertLogs('mkdocs', level='WARNING') as cm: gh_deploy._check_version('gh-pages') self.assertEqual( cm.output, ['WARNING:mkdocs.commands.gh_deploy:Version check skipped: No version specified in previous deployment.'] )
def test_mkdocs_newer(self, mock_popeno): mock_popeno().communicate.return_value = (b'Deployed 12345678 with MkDocs version: 0.1.2\n', b'') with self.assertLogs('mkdocs', level='INFO') as cm: gh_deploy._check_version('gh-pages') self.assertEqual( cm.output, ['INFO:mkdocs.commands.gh_deploy:Previous deployment was done with MkDocs ' 'version 0.1.2; you are deploying with a newer version ({})'.format(__version__)] )
def test_version_unknown(self, mock_popeno): mock_popeno().communicate.return_value = (b'No version specified\n', b'') with self.assertLogs('mkdocs', level='WARNING') as cm: gh_deploy._check_version('gh-pages') self.assertEqual( cm.output, ['WARNING:mkdocs.commands.gh_deploy:Version check skipped: No version specificed in previous deployment.'] )
def test_mkdocs_older(self, mock_popeno): mock_popeno().communicate.return_value = (b'Deployed 12345678 with MkDocs version: 10.1.2\n', b'') with self.assertLogs('mkdocs', level='ERROR') as cm: with self.assertRaises(Abort): gh_deploy._check_version('gh-pages') self.assertEqual( cm.output, ['ERROR:mkdocs.commands.gh_deploy:Deployment terminated: Previous deployment was made with ' f'MkDocs version 10.1.2; you are attempting to deploy with an older version ({__version__}).' ' Use --ignore-version to deploy anyway.'] )