Skip to content

Commit

Permalink
Fix quiet/verbose arguments and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostofGoes authored and mgedmin committed Mar 9, 2020
1 parent 07f6d74 commit 3fdab8e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions check_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,9 +997,9 @@ def main():
help='location for the source tree')
parser.add_argument('--version', action='version',
version='%(prog)s version ' + __version__)
parser.add_argument('--quiet', action='store_const', dest='quiet',
parser.add_argument('-q', '--quiet', action='store_const', dest='quiet',
const=0, default=1, help='reduced output verbosity')
parser.add_argument('--verbose', action='store_const', dest='verbose',
parser.add_argument('-v', '--verbose', action='store_const', dest='verbose',
const=1, default=0, help='more verbose output')
parser.add_argument('-c', '--create', action='store_true',
help='create a MANIFEST.in if missing')
Expand Down
36 changes: 36 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,34 @@ def test_ignore_bad_ideas_args(self):
self.assertEqual(check_manifest.IGNORE_BAD_IDEAS,
['x', 'y', 'z'])

def test_verbose_arg(self):
import check_manifest
check_manifest.VERBOSE = False
sys.argv.append('--verbose')
check_manifest.main()
self.assertTrue(check_manifest.VERBOSE)
check_manifest.VERBOSE = False

def test_quiet_arg(self):
import check_manifest
check_manifest.QUIET = False
sys.argv.append('--quiet')
check_manifest.main()
self.assertTrue(check_manifest.QUIET)
check_manifest.QUIET = False

def test_verbose_and_quiet_arg(self):
import check_manifest
check_manifest.VERBOSE = False
check_manifest.QUIET = False
sys.argv.append('--verbose')
sys.argv.append('--quiet')
check_manifest.main()
self.assertFalse(check_manifest.VERBOSE)
self.assertFalse(check_manifest.QUIET)
check_manifest.VERBOSE = False
check_manifest.QUIET = False


class TestZestIntegration(unittest.TestCase):

Expand Down Expand Up @@ -1299,6 +1327,14 @@ def test_info_verbose(self):
self.assertEqual(sys.stdout.getvalue(),
"Reticulating splines\n")

def test_info_quiet(self):
import check_manifest
check_manifest.VERBOSE = False
check_manifest.QUIET = True
check_manifest.info("Reticulating splines")
self.assertEqual(sys.stdout.getvalue(), "")
check_manifest.QUIET = False

def test_info_begin_continue_end(self):
import check_manifest
check_manifest.VERBOSE = False
Expand Down

0 comments on commit 3fdab8e

Please sign in to comment.