(self, script_name, exit_code, data,
expected_file, expected_argv0,
expected_path0, expected_package,
expected_loader, expected_cwd=None)
| 89 | @support.force_not_colorized_test_class |
| 90 | class CmdLineTest(unittest.TestCase): |
| 91 | def _check_output(self, script_name, exit_code, data, |
| 92 | expected_file, expected_argv0, |
| 93 | expected_path0, expected_package, |
| 94 | expected_loader, expected_cwd=None): |
| 95 | if verbose > 1: |
| 96 | print("Output from test script %r:" % script_name) |
| 97 | print(repr(data)) |
| 98 | self.assertEqual(exit_code, 0) |
| 99 | printed_loader = '__loader__==%a' % expected_loader |
| 100 | printed_file = '__file__==%a' % expected_file |
| 101 | printed_package = '__package__==%r' % expected_package |
| 102 | printed_argv0 = 'sys.argv[0]==%a' % expected_argv0 |
| 103 | printed_path0 = 'sys.path[0]==%a' % expected_path0 |
| 104 | if expected_cwd is None: |
| 105 | expected_cwd = os.getcwd() |
| 106 | printed_cwd = 'cwd==%a' % expected_cwd |
| 107 | if verbose > 1: |
| 108 | print('Expected output:') |
| 109 | print(printed_file) |
| 110 | print(printed_package) |
| 111 | print(printed_argv0) |
| 112 | print(printed_cwd) |
| 113 | self.assertIn(printed_loader.encode('utf-8'), data) |
| 114 | self.assertIn(printed_file.encode('utf-8'), data) |
| 115 | self.assertIn(printed_package.encode('utf-8'), data) |
| 116 | self.assertIn(printed_argv0.encode('utf-8'), data) |
| 117 | # PYTHONSAFEPATH=1 changes the default sys.path[0] |
| 118 | if not sys.flags.safe_path: |
| 119 | self.assertIn(printed_path0.encode('utf-8'), data) |
| 120 | self.assertIn(printed_cwd.encode('utf-8'), data) |
| 121 | |
| 122 | def _check_script(self, script_exec_args, expected_file, |
| 123 | expected_argv0, expected_path0, |
no test coverage detected