Beispiel #1
0
 def test_run_exit_code_2(self):
     """Test that main_entry_point returns the same exit code,
     as the called command"""
     main_entry_point(["create"])  # need venv to run
     with self.assertRaises(ChildExit) as ce:
         main_entry_point(windows_too(["run", "python3", "-c", "exit(2)"]))
     self.assertEqual(ce.exception.code, 2)
Beispiel #2
0
    def test_run_python_version(self):
        main_entry_point(["create"])

        with self.assertRaises(ChildExit):
            # just check the argparser handles --version properly
            # (was failing with nargs='*', ok with nargs=argparse.REMAINDER)
            main_entry_point(windows_too(["run", "python3", "--version"]))
Beispiel #3
0
 def _gpd(self, cmd: str) -> Path:
     cmd = fix_paths(cmd)
     result = get_project_dir(ParsedArgs(windows_too(cmd.split())))
     self.assertTrue(result.is_absolute())
     return result
Beispiel #4
0
 def test_run_needs_venv(self):
     with self.assertRaises(VenvDoesNotExistExit) as cm:
         main_entry_point(windows_too(["run", "python", "-c", "pass"]))
     self.assertIsErrorExit(cm.exception)