def test_install_dryrun(self):
stub_mod_call(self, cli)
tmpdir = mkdtemp(self)
os.chdir(tmpdir)
dist = Distribution(dict(
script_name='setup.py',
script_args=['npm', '--install', '--dry-run'],
name='foo',
))
dist.parse_command_line()
dist.run_commands()
self.assertFalse(exists(join(tmpdir, 'package.json')))
# Ensure that install is NOT called.
self.assertIsNone(self.call_args)
# also log handlers removed.
self.assertEqual(len(getLogger('calmjs.cli').handlers), 0)
# However, default action is view, the package.json should be
# written to stdout with the correct indentation level.
self.assertIn('\n "jquery": "~1.11.0"', sys.stdout.getvalue())
评论列表
文章目录