Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_cmd_line_script Namespace Reference

Classes

class  CmdLineTest

Functions

def _make_test_script
def _make_test_zip_pkg
def _make_launch_script
def test_main

Variables

 verbose = support.verbose
string test_source
string launch_source

Function Documentation

def test.test_cmd_line_script._make_launch_script (   script_dir,
  script_basename,
  module_name,
  path = None 
) [private]

Definition at line 64 of file test_cmd_line_script.py.

00064 
00065 def _make_launch_script(script_dir, script_basename, module_name, path=None):
00066     if path is None:
00067         path = "os.path.dirname(__file__)"
00068     else:
00069         path = repr(path)
00070     source = launch_source % (path, module_name)
00071     return make_script(script_dir, script_basename, source)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_cmd_line_script._make_test_script (   script_dir,
  script_basename,
  source = test_source 
) [private]

Definition at line 46 of file test_cmd_line_script.py.

00046 
00047 def _make_test_script(script_dir, script_basename, source=test_source):
00048     return make_script(script_dir, script_basename, source)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_cmd_line_script._make_test_zip_pkg (   zip_dir,
  zip_basename,
  pkg_name,
  script_basename,
  source = test_source,
  depth = 1 
) [private]

Definition at line 50 of file test_cmd_line_script.py.

00050 
00051                        source=test_source, depth=1):
00052     return make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
00053                         source, depth)
00054 
00055 # There's no easy way to pass the script directory in to get
00056 # -m to work (avoiding that is the whole point of making
00057 # directories and zipfiles executable!)
# So we fake it for testing purposes with a custom launch script

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 277 of file test_cmd_line_script.py.

00277 
00278 def test_main():
00279     support.run_unittest(CmdLineTest)
00280     support.reap_children()


Variable Documentation

Initial value:
00001 """\
00002 import sys, os.path, runpy
00003 sys.path.insert(0, %s)
00004 runpy._run_module_as_main(%r)
00005 """

Definition at line 58 of file test_cmd_line_script.py.

Initial value:
00001 """\
00002 # Script may be run with optimisation enabled, so don't rely on assert
00003 # statements being executed
00004 def assertEqual(lhs, rhs):
00005     if lhs != rhs:
00006         raise AssertionError('%r != %r' % (lhs, rhs))
00007 def assertIdentical(lhs, rhs):
00008     if lhs is not rhs:
00009         raise AssertionError('%r is not %r' % (lhs, rhs))
00010 # Check basic code execution
00011 result = ['Top level assignment']
00012 def f():
00013     result.append('Lower level reference')
00014 f()
00015 assertEqual(result, ['Top level assignment', 'Lower level reference'])
00016 # Check population of magic variables
00017 assertEqual(__name__, '__main__')
00018 print('__file__==%a' % __file__)
00019 assertEqual(__cached__, None)
00020 print('__package__==%r' % __package__)
00021 # Check the sys module
00022 import sys
00023 assertIdentical(globals(), sys.modules[__name__].__dict__)
00024 print('sys.argv[0]==%a' % sys.argv[0])
00025 print('sys.path[0]==%a' % sys.path[0])
00026 # Check the working directory
00027 import os
00028 print('cwd==%a' % os.getcwd())
00029 """

Definition at line 16 of file test_cmd_line_script.py.

Definition at line 14 of file test_cmd_line_script.py.