def test_install_bdist(): "Make sure that the wheel can be installed by Pip" with nimporter.cd('tests/proj1'): subprocess.Popen(f'{PYTHON} setup.py bdist_wheel'.split()).wait() dist = Path('dist') build = Path('build') egg = Path('project1.egg-info') try: assert dist.exists() assert build.exists() assert egg.exists() targets = list(Path('dist').glob('project1*.whl')) assert len(targets) == 1 wheel = targets[0] assert wheel.exists() subprocess.Popen(f'{PIP} install {wheel}'.split()).wait() finally: shutil.rmtree(str(dist.absolute())) shutil.rmtree(str(build.absolute())) shutil.rmtree(str(egg.absolute())) import proj1 assert proj1 assert proj1.performance assert proj1.lib1 assert proj1.foo assert proj1.bar assert proj1.baz assert proj1.baz() == 1 subprocess.Popen(f'{PIP} uninstall project1 -y'.split()).wait()
def test_install_sdist(): "Make sure that the project can be installed by Pip" with nimporter.cd('tests/proj1'): subprocess.Popen(f'{PYTHON} setup.py sdist'.split()).wait() dist = Path('dist') egg = Path('project1.egg-info') try: assert dist.exists() assert egg.exists() targets = list(dist.glob('project1*')) assert len(targets) == 1 assert targets[0].exists() subprocess.Popen(f'{PIP} install .'.split()).wait() finally: shutil.rmtree(str(dist.absolute())) shutil.rmtree(str(egg.absolute())) import proj1 assert proj1 assert proj1.performance assert proj1.lib1 assert proj1.foo assert proj1.bar assert proj1.baz assert proj1.baz() == 1 subprocess.Popen(f'{PIP} uninstall project1 -y'.split()).wait()
def test_install_bdist(): "Make sure that the wheel can be installed by Pip" with nimporter.cd('tests/proj1'): subprocess.Popen(f'{PYTHON} setup.py bdist_wheel'.split()).wait() dist = Path('dist') build = Path('build') egg = Path('project1.egg-info') try: assert dist.exists() assert build.exists() assert egg.exists() targets = list(Path('dist').glob('project1*.whl')) assert len(targets) == 1 wheel = targets[0] assert wheel.exists() subprocess.Popen(f'{PIP} install {wheel}'.split()).wait() finally: shutil.rmtree(str(dist.absolute())) shutil.rmtree(str(build.absolute())) shutil.rmtree(str(egg.absolute())) # Make sure that `tests/proj1` is not imported as a SimpleNamespace and that # the installed library in `site-packages` is used. with nimporter.cd('../..'): try: import proj1 assert proj1 import proj1.performance assert proj1.performance import proj1.lib1 assert proj1.lib1 assert proj1.foo assert proj1.bar assert proj1.baz assert proj1.baz() == 1 except Exception as e: warnings.warn(str(e)) # Cannot delete a DLL in use by another process on Windows if sys.platform != 'win32': subprocess.Popen(f'{PIP} uninstall project1 -y'.split()).wait()