Ejemplo n.º 1
0
def test_py2app_future_condition_3_fix():
    '''tests our fix when importing everything under the sun!'''
    setup, options, new_script = py2app_setup('py2app fixed', 'py2app_fixed.py')
    insert_code(new_script,
                'import past')
    freeze_future.setup(**options)
    clean_exit, stderr = run_script(new_script, freezer='py2app')
    assert clean_exit
Ejemplo n.º 2
0
def test_py2app_future_condition_3_fix():
    '''tests our fix when importing everything under the sun!'''
    setup, options, new_script = py2app_setup('py2app fixed',
                                              'py2app_fixed.py')
    insert_code(new_script, 'import past')
    freeze_future.setup(**options)
    clean_exit, stderr = run_script(new_script, freezer='py2app')
    assert clean_exit
Ejemplo n.º 3
0
def test_cxfreeze_future_condition_3_fix():
    '''tests our fix when importing everything under the sun! also
    import builtins TBD this test is a bit flakey when running the entire suite and doing tests on py 2 and py3'''
    setup, options, new_script = cxfreeze_setup('cxfreeze fixed',
                                                'cxfreeze_fixed.py')
    insert_code(new_script, 'import past')
    freeze_future.setup(**options)
    clean_exit, stderr = run_script(new_script, freezer='cxfreeze')
    assert clean_exit
Ejemplo n.º 4
0
def test_cxfreeze_future_condition_3_fix():
    '''tests our fix when importing everything under the sun! also
    import builtins TBD this test is a bit flakey when running the entire suite and doing tests on py 2 and py3'''
    setup, options, new_script = cxfreeze_setup('cxfreeze fixed', 'cxfreeze_fixed.py')
    insert_code(new_script,
                'import past')
    freeze_future.setup(**options)
    clean_exit, stderr = run_script(new_script, freezer='cxfreeze')
    assert clean_exit
Ejemplo n.º 5
0
def test_freeze_future_running_when_using_future_with_py2app():
    '''Tests that a script with the future imports gets recognized and the freeze future code is run'''
    setup, options, new_script = py2app_setup('should run the setup stuff', 'py2app_reuturn_working.py')
    insert_code(new_script,
                "from future import standard_library",
                "standard_library.install_aliases()")
    if PY3:
        assert freeze_future.setup(test_setup=True, **options) == False
    else:
        assert freeze_future.setup(test_setup=True, **options) == True
Ejemplo n.º 6
0
def test_freeze_future_running_when_using_future_with_cxfreeze():
    '''Tests that a script with the future imports gets recognized and the freeze future code is run'''
    setup, options, new_script = cxfreeze_setup('should run the setup stuff',
                                                'cxfreeze_reuturn_working.py')
    insert_code(new_script, "from future import standard_library",
                "standard_library.install_aliases()")
    if PY3:
        assert freeze_future.setup(test_setup=True, **options) == False
    else:
        assert freeze_future.setup(test_setup=True, **options) == True
Ejemplo n.º 7
0
def test_freeze_future_running_when_using_future_with_py2exe():
    '''Tests that a script with the future imports gets recognized and we run
    our code'''
    setup, options, new_script = py2exe_setup('should run the setup stuff', 'py2exe_return_test.py')
    insert_code(new_script,
                "from __future__ import print_function",
                "from future import standard_library",
                "standard_library.install_aliases()")
    if PY3:
        assert freeze_future.setup(test_setup=True, **options) == False
    else:
        assert freeze_future.setup(test_setup=True, **options) == True
Ejemplo n.º 8
0
	def test_running_when_using_future(self):
		'''Tests that a script with the future imports gets recognized and we run
		our code'''			
		setup, options, new_script = self.esky_setup('should run the setup stuff', 'esky_reuturn_working.py')
		insert_code(new_script,
			"from __future__ import print_function",
			"from future import standard_library",
			"standard_library.install_aliases()")
		dummy_setup = lambda *args, **kwargs: 0
		
		if PY3:
			assert freeze_future.setup(dummy_setup, **options) == False
		else:
			assert freeze_future.setup(dummy_setup, **options) == True
Ejemplo n.º 9
0
def test_py2exe_future_condition_3_fix():
    '''tests our fix when importing everything under the sun! also
    import builtins TBD this test is a bit flakey when running the entire suite and doing tests on py 2 and py3'''
    setup, options, new_script = py2exe_setup('py2exe fixed', 'py2exe_fixed.py')
    insert_code(new_script,
                'import past')
    freeze_future.setup(**options)
    clean_exit, stderr = run_script(new_script, freezer='py2exe')
    if not clean_exit:
        with open(r'dist/py2exe_fixed.log', newline='\n') as log:
            from pprint import pprint
            pprint(log.readlines())
            import pdb;pdb.set_trace()

    assert clean_exit
Ejemplo n.º 10
0
def test_py2app_freeze_future_condition_one_fix():
    '''tests our fix when importing everything under the sun!, just another sanity check'''
    setup, options, new_script = py2app_setup('py2app fixed', 'py2app_fixed.py')
    insert_code(new_script,
                "from future import standard_library",
                "standard_library.install_aliases()",
                "import urllib.request, urllib.error, urllib.parse",
                "import collections",
                "from itertools import filterfalse",
                "from subprocess import getoutput",
                "from builtins import str",
                "from builtins import range",)
    freeze_future.setup(**options)
    clean_exit, stderr = run_script(new_script, freezer='py2app')
    assert clean_exit
Ejemplo n.º 11
0
def test_py2app_work_with_no_standard_library():
    '''does our code with without the standard librar function call'''
    setup, options, new_script = py2app_setup('py2app works_nostandardlin', 'py2app_works_no_stdlib.py')
    insert_code(new_script,
                "from __future__ import absolute_import, division, print_function",
                "from builtins import (bytes, str, open, super, range,",
                "    zip, round, input, int, pow, object)")
    freeze_future.setup(**options)
    if PY3:
        clean_exit, stderr = run_script(new_script, freezer='py2app')
        assert clean_exit
    else:
        #with pytest.raises(Exception):# I think my exit code is shadowing the exception or sth?? or my sys.exit call
        clean_exit, stderr = run_script(new_script, freezer='py2app')
        assert clean_exit
Ejemplo n.º 12
0
def test_setuptools_return_when_using_future():
    '''Tests that a script with the future imports runs as normal'''            
    setup, options, new_script = setuptools_setup('should run the setup stuff', 'disturils_return_working.py')
    insert_code(new_script,
                "from __future__ import print_function",
                "from future import standard_library",
                "standard_library.install_aliases()")
    assert freeze_future.setup(**options) == False
Ejemplo n.º 13
0
def test_py2app_work_with_no_standard_library():
    '''does our code with without the standard librar function call'''
    setup, options, new_script = py2app_setup('py2app works_nostandardlin',
                                              'py2app_works_no_stdlib.py')
    insert_code(
        new_script,
        "from __future__ import absolute_import, division, print_function",
        "from builtins import (bytes, str, open, super, range,",
        "    zip, round, input, int, pow, object)")
    freeze_future.setup(**options)
    if PY3:
        clean_exit, stderr = run_script(new_script, freezer='py2app')
        assert clean_exit
    else:
        #with pytest.raises(Exception):# I think my exit code is shadowing the exception or sth?? or my sys.exit call
        clean_exit, stderr = run_script(new_script, freezer='py2app')
        assert clean_exit
Ejemplo n.º 14
0
def test_esky_freeze_future_condition_two_fix():
    '''
    Testing adding the future imports doesn't f**k up the building on python3
    F***s up python2 though
    Esky allows setup to compile, but the script will not run
    '''
    setup, options, new_script = esky_setup('Working with Future Import', 'esky_future_working.py')
    insert_code(new_script,
                "from __future__ import print_function",)
    if PY3:
        freeze_future.setup(**options)
        clean_exit, stderr = run_script(new_script, freezer='esky')
        assert clean_exit
    else:
        freeze_future.setup(**options)
        clean_exit, stderr = run_script(new_script, freezer='esky')
        assert not clean_exit
Ejemplo n.º 15
0
def test_cxfreeze_freeze_future_condition_one_fix():
    '''tests our fix when importing everything under the sun!, just another sanity check'''
    setup, options, new_script = cxfreeze_setup('cxfreeze fixed',
                                                'cxfreeze_fixed.py')
    insert_code(
        new_script,
        "from future import standard_library",
        "standard_library.install_aliases()",
        "import urllib.request, urllib.error, urllib.parse",
        "import collections",
        "from itertools import filterfalse",
        "from subprocess import getoutput",
        "from builtins import str",
        "from builtins import range",
    )
    freeze_future.setup(**options)
    clean_exit, stderr = run_script(new_script, freezer='cxfreeze')
    assert clean_exit
Ejemplo n.º 16
0
	def test_esky_fix_future_2(self):
		'''tests our fix when importing everything under the sun! also
		import builtins'''
		setup, options, new_script = self.esky_setup('esky fixed2', 'esky_fixed2.py')
		
		insert_code(new_script, 
					"from __future__ import print_function",
					"from future import standard_library",
					"standard_library.install_aliases()",
					"import urllib.request, urllib.error, urllib.parse",
					"import collections",
					"from itertools import filterfalse",
					"from subprocess import getoutput",
					"from builtins import str",
					"from builtins import range",)
		
		freeze_future.setup(setup, **options)
		assert run_script(new_script, freezer='esky')
Ejemplo n.º 17
0
	def test_esky_fix_future(self):
		'''tests our fix'''
		setup, options, new_script = self.esky_setup('esky fixed', 'esky_fixed.py')
		
		insert_code(new_script, 
					"from future import standard_library",
					"standard_library.install_aliases()")
		
		if freeze_future.setup(setup, **options):
			assert run_script(new_script, freezer='esky')
		else:
			assert 0
Ejemplo n.º 18
0
	def test_cxfreeze_fix_future(self):
		'''tests our fix'''
		setup, options, new_script = self.cxfreeze_setup('cxfreeze fixed', 'cxfreeze_fixed.py')
		
		insert_code(new_script, 
					"from __future__ import print_function",
					"from future import standard_library",
					"standard_library.install_aliases()")
		
		if freeze_future.setup(setup, **options):
			assert run_script(new_script)
		else:
			assert 0
Ejemplo n.º 19
0
def test_py2app_freeze_future_return_when_no_future_import():
    '''Make sure we don't do any work if not using the future library'''
    setup, options, new_script = py2app_setup('working script no future should return', WORKING_SCRIPT)
    assert freeze_future.setup(**options) == False
Ejemplo n.º 20
0
def test_cxfreeze_freeze_future_return_when_no_future_import():
    '''Make sure we don't do any work if not using the future library'''
    setup, options, new_script = cxfreeze_setup(
        'working script no future should return', WORKING_SCRIPT)
    assert freeze_future.setup(**options) == False
Ejemplo n.º 21
0
	def test_setuptools_return_when_no_future_import(self):
		'''Make sure we don't do any work if not using the future library'''	
		setup, options, name = self.setuptools_setup('working script no future should return', WORKING_SCRIPT)
		assert freeze_future.setup(setup, **options) == False