
    }ed                     h    d Z ddlZddlmZ ddlmZ  G d dej                  ej                        Z	y)z>Tests for shellapp module.

Authors
-------
* Bradley Froehle
    N)
decorators)toolsc                   @    e Zd ZdZd Zd Zej                  d        Zy)TestFileToRunz/Test the behavior of the file_to_run parameter.c                     d}| j                  |       d}t        j                  | j                  | j                  |       y)z:Test that `__file__` is set when running `ipython file.py`print(__file__)
Nmktmpttipexec_validatefnameselfsrcerrs      B/usr/lib/python3/dist-packages/IPython/core/tests/test_shellapp.pytest_py_script_file_attributez+TestFileToRun.test_py_script_file_attribute   s1    !

3
4::tzz37    c                     d}| j                  |d       d}t        j                  | j                  | j                  |       y)z;Test that `__file__` is set when running `ipython file.ipy`r   z.ipy)extNr	   r   s      r   test_ipy_script_file_attributez,TestFileToRun.test_ipy_script_file_attribute#   s6    !

3F
#
4::tzz37r   c                     d}| j                  |       t        j                  | j                  dgg d      \  }}d|v sJ d| d       y)	z:Test that `__file__` is not set after `ipython -i file.py`zTrue
z-i)z"__file__" in globals()z
print(123)zexit())optionscommandsFalsezSubprocess stderr:
z
-----N)r
   r   ipexecr   )r   r   outr   s       r   +test_py_script_file_attribute_interactivelyz9TestFileToRun.test_py_script_file_attribute_interactively-   sR     

399JJFH
S
 #~B!5cU'BB~r   N)	__name__
__module____qualname____doc__r   r   dec
skip_win32r    r   r   r   r      s)    988 	^^
C 
Cr   r   )
r"   unittestIPython.testingr   r#   r   r   TempFileMixinTestCaser   r%   r   r   <module>r*      s1      - ' CB$$h&7&7  Cr   