def test_exit_code_2_on_failure(self): from check_manifest import main, Failure self._check_manifest.side_effect = Failure('msg') main() self._error.assert_called_with('msg') self._sys_exit.assert_called_with(2)
def test_extra_ignore_args(self): import check_manifest sys.argv.append('--ignore=x,y,z') check_manifest.main() self.assertEqual(check_manifest.IGNORE, ['default-ignore-rules', 'x', 'y', 'z'])
def test(self): from check_manifest import main sys.argv.append('-v') main()
def test_exit_code_1_on_error(self): from check_manifest import main self._check_manifest.return_value = False main() self._sys_exit.assert_called_with(1)
""" Script used by tox.ini to check the manifest file if we are under version control, or skip the check altogether if not. "check-manifest" will needs a vcs to work, which is not available when testing the package instead of the source code (with ``devpi test`` for example). """ from __future__ import print_function import os import subprocess import sys from check_manifest import main if os.path.isdir('.git'): sys.exit(main()) else: print('No .git directory found, skipping checking the manifest file') sys.exit(0)