Author: Brian Kearns <[email protected]>
Branch:
Changeset: r61039:c7f4ca65c2ce
Date: 2013-02-10 08:04 -0500
http://bitbucket.org/pypy/pypy/changeset/c7f4ca65c2ce/
Log: fix test_app_main
diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -223,7 +223,6 @@
else:
IS_WINDOWS = False
-
def setup_and_fix_paths(ignore_environment=False, **extra):
import os
newpath = sys.path[:]
@@ -303,7 +302,6 @@
"hash_randomization",
)
-
default_options = dict.fromkeys(
sys_flags +
("run_command",
@@ -312,7 +310,6 @@
"warnoptions",
"unbuffered"), 0)
-
PYTHON26 = True
def simple_option(options, name, iterargv):
@@ -376,10 +373,9 @@
'R': (simple_option, 'hash_randomization'),
})
-
def handle_argument(c, options, iterargv, iterarg=iter(())):
function, funcarg = cmdline_options[c]
- #
+
# If needed, fill in the real argument by taking it from the command line
if funcarg is Ellipsis:
remaining = list(iterarg)
@@ -392,15 +388,14 @@
if len(c) == 1:
c = '-' + c
raise CommandLineError('Argument expected for the %r option' %
c)
- #
+
return function(options, funcarg, iterargv)
-
def parse_command_line(argv):
import os
options = default_options.copy()
options['warnoptions'] = []
- #
+
iterargv = iter(argv)
argv = None
for arg in iterargv:
diff --git a/pypy/interpreter/test2/test_app_main.py
b/pypy/interpreter/test2/test_app_main.py
--- a/pypy/interpreter/test2/test_app_main.py
+++ b/pypy/interpreter/test2/test_app_main.py
@@ -72,7 +72,6 @@
class TestParseCommandLine:
-
def check_options(self, options, sys_argv, **expected):
assert sys.argv == sys_argv
for key, value in expected.items():
@@ -191,14 +190,13 @@
monkeypatch.setenv('PYTHONNOUSERSITE', '1')
expected = {"no_user_site": True}
self.check(['-c', 'pass'], sys_argv=['-c'], run_command='pass',
**expected)
-
+
class TestInteraction:
"""
These tests require pexpect (UNIX-only).
http://pexpect.sourceforge.net/
"""
-
def setup_class(cls):
# some tests need to be able to import test2, change the cwd
goal_dir =
os.path.abspath(os.path.join(os.path.realpath(os.path.dirname(__file__)), '..'))
@@ -567,8 +565,8 @@
child = self.spawn(argv)
child.expect('False')
+
class TestNonInteractive:
-
def run_with_status_code(self, cmdline, senddata='', expect_prompt=False,
expect_banner=False, python_flags='', env=None):
cmdline = '%s %s "%s" %s' % (sys.executable, python_flags,
@@ -896,7 +894,7 @@
self.w_fake_exe = self.space.wrap(str(fake_exe))
self.w_expected_path = self.space.wrap(expected_path)
self.w_trunkdir = self.space.wrap(os.path.dirname(pypydir))
- #
+
foo_py = prefix.join('foo.py').write("pass")
self.w_foo_py = self.space.wrap(str(foo_py))
@@ -908,7 +906,7 @@
import app_main
app_main.setup_bootstrap_path('/tmp/pypy-c') # stdlib not found
assert sys.executable == ''
- assert sys.path[:-1] == old_sys_path
+ assert sys.path[:len(old_sys_path)] == old_sys_path
app_main.setup_bootstrap_path(self.fake_exe)
assert sys.executable == self.fake_exe
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit