guarding scripts with __main__ and doc changes
tox-flakes environment tries to import the modules for checking, and that may fail because of its dependencies --HG-- branch : cx_freeze-support
This commit is contained in:
		
							parent
							
								
									82d573e391
								
							
						
					
					
						commit
						3c649cf91d
					
				| 
						 | 
				
			
			@ -703,7 +703,8 @@ must declare them explicitly by using ``pytest.cx_freeze_support.includes()``::
 | 
			
		|||
    import pytest
 | 
			
		||||
 | 
			
		||||
    setup(
 | 
			
		||||
        name="runtests",
 | 
			
		||||
        name="app_main",
 | 
			
		||||
        executables=[Executable("app_main.py")],
 | 
			
		||||
        options={"build_exe":
 | 
			
		||||
            {
 | 
			
		||||
            'includes': pytest.cx_freeze_support.includes()}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +1,15 @@
 | 
			
		|||
"""
 | 
			
		||||
Sample setup.py script that generates an executable with pytest runner embedded.
 | 
			
		||||
"""
 | 
			
		||||
from cx_Freeze import setup, Executable
 | 
			
		||||
import pytest
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    from cx_Freeze import setup, Executable
 | 
			
		||||
    import pytest
 | 
			
		||||
 | 
			
		||||
setup(
 | 
			
		||||
    name="runtests",
 | 
			
		||||
    version="0.1",
 | 
			
		||||
    description="exemple of how embedding py.test into an executable using cx_freeze",
 | 
			
		||||
    executables=[Executable("runtests_script.py")],
 | 
			
		||||
    options={"build_exe": {'includes': pytest.cx_freeze_support.includes()}},
 | 
			
		||||
)
 | 
			
		||||
    setup(
 | 
			
		||||
        name="runtests",
 | 
			
		||||
        version="0.1",
 | 
			
		||||
        description="exemple of how embedding py.test into an executable using cx_freeze",
 | 
			
		||||
        executables=[Executable("runtests_script.py")],
 | 
			
		||||
        options={"build_exe": {'includes': pytest.cx_freeze_support.includes()}},
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,10 +5,11 @@ directory.
 | 
			
		|||
.. note:: somehow calling "build/runtests_script" directly from tox doesn't
 | 
			
		||||
          seem to work (at least on Windows).
 | 
			
		||||
"""
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    import os
 | 
			
		||||
    import sys
 | 
			
		||||
 | 
			
		||||
executable = os.path.join(os.getcwd(), 'build', 'runtests_script')
 | 
			
		||||
if sys.platform.startswith('win'):
 | 
			
		||||
    executable += '.exe'
 | 
			
		||||
sys.exit(os.system('%s tests' % executable))
 | 
			
		||||
    executable = os.path.join(os.getcwd(), 'build', 'runtests_script')
 | 
			
		||||
    if sys.platform.startswith('win'):
 | 
			
		||||
        executable += '.exe'
 | 
			
		||||
    sys.exit(os.system('%s tests' % executable))
 | 
			
		||||
		Loading…
	
		Reference in New Issue