Merge pull request #881 from maartenq/master
setuptools not present issue deprecating gentest
This commit is contained in:
		
						commit
						80ee620459
					
				| 
						 | 
				
			
			@ -68,6 +68,11 @@ class DictImporter(object):
 | 
			
		|||
        return res
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    try:
 | 
			
		||||
        import pkg_resources  # noqa
 | 
			
		||||
    except ImportError:
 | 
			
		||||
        sys.stderr.write("ERROR: setuptools not installed\n")
 | 
			
		||||
        sys.exit(2)
 | 
			
		||||
    if sys.version_info >= (3, 0):
 | 
			
		||||
        exec("def do_exec(co, loc): exec(co, loc)\n")
 | 
			
		||||
        import pickle
 | 
			
		||||
| 
						 | 
				
			
			@ -80,6 +85,5 @@ if __name__ == "__main__":
 | 
			
		|||
 | 
			
		||||
    importer = DictImporter(sources)
 | 
			
		||||
    sys.meta_path.insert(0, importer)
 | 
			
		||||
 | 
			
		||||
    entry = "@ENTRY@"
 | 
			
		||||
    do_exec(entry, locals()) # noqa
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,13 +27,17 @@ def test_gen(testdir, anypython, standalone):
 | 
			
		|||
            pytest.skip("genscript called from python2.7 cannot work "
 | 
			
		||||
                        "earlier python versions")
 | 
			
		||||
    result = standalone.run(anypython, testdir, '--version')
 | 
			
		||||
    assert result.ret == 0
 | 
			
		||||
    result.stderr.fnmatch_lines([
 | 
			
		||||
        "*imported from*mypytest*"
 | 
			
		||||
    ])
 | 
			
		||||
    p = testdir.makepyfile("def test_func(): assert 0")
 | 
			
		||||
    result = standalone.run(anypython, testdir, p)
 | 
			
		||||
    assert result.ret != 0
 | 
			
		||||
    if result.ret == 2:
 | 
			
		||||
        result.stderr.fnmatch_lines(["*ERROR: setuptools not installed*"])
 | 
			
		||||
    elif result.ret == 0:
 | 
			
		||||
        result.stderr.fnmatch_lines([
 | 
			
		||||
            "*imported from*mypytest*"
 | 
			
		||||
        ])
 | 
			
		||||
        p = testdir.makepyfile("def test_func(): assert 0")
 | 
			
		||||
        result = standalone.run(anypython, testdir, p)
 | 
			
		||||
        assert result.ret != 0
 | 
			
		||||
    else:
 | 
			
		||||
        pytest.fail("Unexpected return code")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_freeze_includes():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue