def test_create_cmdclass(make_package_deprecated, mocker):
    source = ("share/test.txt", )
    spec = ("jupyter-packaging-test", "share", "**/*")
    target = "jupyter-packaging-test/test.txt"

    pkg_path = make_package_deprecated(data_files=source, data_files_spec=spec)
    os.chdir(pkg_path)
    cmdclass = pkg.create_cmdclass(package_data_spec=dict(foo="*.*"),
                                   data_files_spec=[spec],
                                   exclude=lambda x: False)
    for name in ['build_py', 'handle_files', 'sdist', 'bdist_wheel']:
        assert name in cmdclass

    dist = Distribution()
    cmdclass['handle_files'](dist).run()
    assert dist.data_files == [('jupyter-packaging-test', ['share/test.txt'])]
    assert dist.package_data == {'foo': []}

    # Test installation of data_files in develop mode
    dist = Distribution()
    handler = cmdclass['handle_files'](dist)
    develop = cmdclass['develop'](dist)

    def run_command(name):
        cmdclass[name](dist).run()

    mocker.patch.object(pkg.develop, 'install_for_development')
    develop.run_command = run_command
    develop.install_for_development()
    assert dist.data_files == [('jupyter-packaging-test', ['share/test.txt'])]
Exemplo n.º 2
0
 name='jupyter-packaging',
 version=__version__,
 packages=find_packages(here),
 description="Jupyter Packaging Utilities",
 long_description="""
 This package contains utilities for making Python packages with
 and without accompanying JavaScript packages.
 """,
 long_description_content_type='text/x-rst',
 author='Jupyter Development Team',
 author_email='*****@*****.**',
 url='http://jupyter.org',
 license='BSD',
 platforms="Linux, Mac OS X, Windows",
 keywords=['Jupyter', 'Packaging'],
 cmdclass=create_cmdclass(),
 python_requires='>=3.6',
 install_requires="packaging",
 extras_require={
     'test': ['pytest'],
 },
 classifiers=[
     'Intended Audience :: Developers',
     'Intended Audience :: System Administrators',
     'Intended Audience :: Science/Research',
     'License :: OSI Approved :: BSD License',
     'Programming Language :: Python',
     'Programming Language :: Python :: 3',
     'Programming Language :: Python :: 3.6',
     'Programming Language :: Python :: 3.7',
     'Programming Language :: Python :: 3.8',