示例#1
0
 def test_cmdline_copy_change_main(self):
     original = self.make_archive()
     target = self.tmpdir / 'target.pyz'
     args = [str(original), '-o', str(target), '-m', 'foo:bar']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     self.assertTrue(cm.exception.code)
示例#2
0
 def test_cmdline_copy(self):
     # Test copying an archive.
     original = self.make_archive()
     target = self.tmpdir / 'target.pyz'
     args = [str(original), '-o', str(target)]
     zipapp.main(args)
     self.assertTrue(target.is_file())
示例#3
0
 def test_cmdline_copy(self):
     # Test copying an archive.
     original = self.make_archive()
     target = self.tmpdir / 'target.pyz'
     args = [str(original), '-o', str(target)]
     zipapp.main(args)
     self.assertTrue(target.is_file())
示例#4
0
 def test_info_command(self, mock_stdout):
     target = self.make_archive()
     args = [str(target), '--info']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     self.assertEqual(cm.exception.code, 0)
     self.assertEqual(mock_stdout.getvalue(), 'Interpreter: <none>\n')
示例#5
0
 def test_info_error(self):
     # Test the info command fails when the archive does not exist.
     target = self.tmpdir / 'dummy.pyz'
     args = [str(target), '--info']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a non-zero returm code.
     self.assertTrue(cm.exception.code)
示例#6
0
 def test_cmdline_create(self):
     source = self.tmpdir / 'source'
     source.mkdir()
     (source / '__main__.py').touch()
     args = [str(source)]
     zipapp.main(args)
     target = source.with_suffix('.pyz')
     self.assertTrue(target.is_file())
示例#7
0
 def test_info_error(self):
     # Test the info command fails when the archive does not exist.
     target = self.tmpdir / 'dummy.pyz'
     args = [str(target), '--info']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a non-zero returm code.
     self.assertTrue(cm.exception.code)
示例#8
0
 def test_cmdline_copy_inplace(self):
     # Test copying an archive in place fails.
     original = self.make_archive()
     target = self.tmpdir / 'target.pyz'
     args = [str(original), '-o', str(original)]
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a non-zero returm code.
     self.assertTrue(cm.exception.code)
示例#9
0
 def test_info_command(self, mock_stdout):
     # Test the output of the info command.
     target = self.make_archive()
     args = [str(target), '--info']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a zero returm code.
     self.assertEqual(cm.exception.code, 0)
     self.assertEqual(mock_stdout.getvalue(), "Interpreter: <none>\n")
示例#10
0
 def test_cmdline_copy_change_main(self):
     # Test copying an archive doesn't allow changing __main__.py.
     original = self.make_archive()
     target = self.tmpdir / 'target.pyz'
     args = [str(original), '-o', str(target), '-m', 'foo:bar']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a non-zero returm code.
     self.assertTrue(cm.exception.code)
示例#11
0
 def test_cmdline_copy_inplace(self):
     # Test copying an archive in place fails.
     original = self.make_archive()
     target = self.tmpdir / 'target.pyz'
     args = [str(original), '-o', str(original)]
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a non-zero returm code.
     self.assertTrue(cm.exception.code)
示例#12
0
 def test_info_command(self, mock_stdout):
     # Test the output of the info command.
     target = self.make_archive()
     args = [str(target), '--info']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a zero returm code.
     self.assertEqual(cm.exception.code, 0)
     self.assertEqual(mock_stdout.getvalue(), "Interpreter: <none>\n")
示例#13
0
 def test_cmdline_copy_change_main(self):
     # Test copying an archive doesn't allow changing __main__.py.
     original = self.make_archive()
     target = self.tmpdir / 'target.pyz'
     args = [str(original), '-o', str(target), '-m', 'foo:bar']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     # Program should exit with a non-zero returm code.
     self.assertTrue(cm.exception.code)
示例#14
0
 def test_cmdline_create(self):
     # Test the basic command line API.
     source = self.tmpdir / 'source'
     source.mkdir()
     (source / '__main__.py').touch()
     args = [str(source)]
     zipapp.main(args)
     target = source.with_suffix('.pyz')
     self.assertTrue(target.is_file())
示例#15
0
 def test_info_error(self):
     target = self.tmpdir / 'dummy.pyz'
     args = [str(target), '--info']
     with self.assertRaises(SystemExit) as cm:
         zipapp.main(args)
     self.assertTrue(cm.exception.code)
示例#16
0
文件: setup.py 项目: SeaHOH/ban-peers
 def run(self):
     import zipapp
     self.run_command('build_mo')
     log.info("Creating Zip App archive '%s'", self.output)
     zipapp.main(self.zipapp_args)
示例#17
0
文件: nodes.py 项目: xxoolm/Ryven
 def update_event(self, inp=-1):
     self.set_output_val(0, zipapp.main(self.input(0)))