Current File : //opt/imh-python/lib/python2.7/test/test_cmd_line_script.pyc |
�
��Wc @ s d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m
Z
m Z m Z m
Z
m Z e j j Z d d d g Z d Z e d � Z e d d � Z d
Z d d � Z d e j f d
� � YZ d � Z e d k r� e � n d S( i����N( t
run_pythont temp_dirt make_scriptt compile_scriptt assert_python_failuret make_pkgt make_zip_scriptt make_zip_pkgt test1t test2t test3s # Script may be run with optimisation enabled, so don't rely on assert
# statements being executed
def assertEqual(lhs, rhs):
if lhs != rhs:
raise AssertionError('%r != %r' % (lhs, rhs))
def assertIdentical(lhs, rhs):
if lhs is not rhs:
raise AssertionError('%r is not %r' % (lhs, rhs))
# Check basic code execution
result = ['Top level assignment']
def f():
result.append('Lower level reference')
f()
assertEqual(result, ['Top level assignment', 'Lower level reference'])
# Check population of magic variables
assertEqual(__name__, '__main__')
print '__file__==%r' % __file__
print '__package__==%r' % __package__
# Check the sys module
import sys
assertIdentical(globals(), sys.modules[__name__].__dict__)
print 'sys.argv[0]==%r' % sys.argv[0]
c C s t | | | � S( N( R ( t
script_dirt script_basenamet source( ( sr /builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cmd_line_script.pyt _make_test_script+ s i c C s t | | | | | | � S( N( R ( t zip_dirt zip_basenamet pkg_nameR R
t depth( ( sr /builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cmd_line_script.pyt _make_test_zip_pkg. s sP import sys, os.path, runpy
sys.path.insert(0, %s)
runpy._run_module_as_main(%r)
c C sA | d k r d } n t | � } t | | f } t | | | � S( Ns os.path.dirname(__file__)( t Nonet reprt
launch_sourceR ( R R t module_namet pathR
( ( sr /builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cmd_line_script.pyt _make_launch_script= s
t CmdLineTestc B s� e Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z
d � Z d
� Z d � Z
d � Z d
� Z d � Z d � Z d � Z e j d � � Z d � Z d � Z d � Z d � Z d � Z RS( c G s� | | f } t | � \ } } t r6 d | GH| GHn | j | d � d | } d | }
d | } t r� d GH| GH| GH|
GHn | j | | � | j | | � | j |
| � d S( Ns Output from test script %r:i s __file__==%rs sys.argv[0]==%rs __package__==%rs Expected output:( R t verboset assertEqualt assertIn( t selft script_namet
expected_filet expected_argv0t expected_packaget cmd_line_switchest run_argst exit_codet datat printed_filet
printed_argv0t printed_package( ( sr /builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cmd_line_script.pyt
_check_scriptF s"