mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-116858: Add @cpython_only
to several tests in test_cmd_line
(#116859)
This commit is contained in:
parent
0c7dc494f2
commit
a1c4923d65
1 changed files with 10 additions and 0 deletions
|
@ -38,6 +38,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
self.assertNotIn(b'Traceback', err)
|
self.assertNotIn(b'Traceback', err)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_help(self):
|
def test_help(self):
|
||||||
self.verify_valid_flag('-h')
|
self.verify_valid_flag('-h')
|
||||||
self.verify_valid_flag('-?')
|
self.verify_valid_flag('-?')
|
||||||
|
@ -48,14 +49,17 @@ class CmdLineTest(unittest.TestCase):
|
||||||
self.assertNotIn(b'-X dev', out)
|
self.assertNotIn(b'-X dev', out)
|
||||||
self.assertLess(len(lines), 50)
|
self.assertLess(len(lines), 50)
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_help_env(self):
|
def test_help_env(self):
|
||||||
out = self.verify_valid_flag('--help-env')
|
out = self.verify_valid_flag('--help-env')
|
||||||
self.assertIn(b'PYTHONHOME', out)
|
self.assertIn(b'PYTHONHOME', out)
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_help_xoptions(self):
|
def test_help_xoptions(self):
|
||||||
out = self.verify_valid_flag('--help-xoptions')
|
out = self.verify_valid_flag('--help-xoptions')
|
||||||
self.assertIn(b'-X dev', out)
|
self.assertIn(b'-X dev', out)
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_help_all(self):
|
def test_help_all(self):
|
||||||
out = self.verify_valid_flag('--help-all')
|
out = self.verify_valid_flag('--help-all')
|
||||||
lines = out.splitlines()
|
lines = out.splitlines()
|
||||||
|
@ -74,6 +78,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
def test_site_flag(self):
|
def test_site_flag(self):
|
||||||
self.verify_valid_flag('-S')
|
self.verify_valid_flag('-S')
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_version(self):
|
def test_version(self):
|
||||||
version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
|
version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
|
||||||
for switch in '-V', '--version', '-VV':
|
for switch in '-V', '--version', '-VV':
|
||||||
|
@ -139,6 +144,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
self.assertEqual(err, b'')
|
self.assertEqual(err, b'')
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_xoption_frozen_modules(self):
|
def test_xoption_frozen_modules(self):
|
||||||
tests = {
|
tests = {
|
||||||
('=on', 'FrozenImporter'),
|
('=on', 'FrozenImporter'),
|
||||||
|
@ -153,6 +159,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
res = assert_python_ok(*cmd)
|
res = assert_python_ok(*cmd)
|
||||||
self.assertRegex(res.out.decode('utf-8'), expected)
|
self.assertRegex(res.out.decode('utf-8'), expected)
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_env_var_frozen_modules(self):
|
def test_env_var_frozen_modules(self):
|
||||||
tests = {
|
tests = {
|
||||||
('on', 'FrozenImporter'),
|
('on', 'FrozenImporter'),
|
||||||
|
@ -579,6 +586,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
print("del sys.modules['__main__']", file=script)
|
print("del sys.modules['__main__']", file=script)
|
||||||
assert_python_ok(filename)
|
assert_python_ok(filename)
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_unknown_options(self):
|
def test_unknown_options(self):
|
||||||
rc, out, err = assert_python_failure('-E', '-z')
|
rc, out, err = assert_python_failure('-E', '-z')
|
||||||
self.assertIn(b'Unknown option: -z', err)
|
self.assertIn(b'Unknown option: -z', err)
|
||||||
|
@ -691,6 +699,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
self.assertEqual(proc.returncode, 0, proc)
|
self.assertEqual(proc.returncode, 0, proc)
|
||||||
return proc.stdout.rstrip()
|
return proc.stdout.rstrip()
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_xdev(self):
|
def test_xdev(self):
|
||||||
# sys.flags.dev_mode
|
# sys.flags.dev_mode
|
||||||
code = "import sys; print(sys.flags.dev_mode)"
|
code = "import sys; print(sys.flags.dev_mode)"
|
||||||
|
@ -914,6 +923,7 @@ class CmdLineTest(unittest.TestCase):
|
||||||
self.assertEqual(proc.returncode, 0, proc)
|
self.assertEqual(proc.returncode, 0, proc)
|
||||||
self.assertEqual(proc.stdout.strip(), b'0')
|
self.assertEqual(proc.stdout.strip(), b'0')
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_parsing_error(self):
|
def test_parsing_error(self):
|
||||||
args = [sys.executable, '-I', '--unknown-option']
|
args = [sys.executable, '-I', '--unknown-option']
|
||||||
proc = subprocess.run(args,
|
proc = subprocess.run(args,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue