fny
fny

Reputation: 33537

Test Built Python Package

So I recently built a Python package that required a few YAML files for configuration. Following the distribution instructions I created a manifest file that looks like the following:

include LICENSE.txt
recursive-include thecurator *.yml *.csv *.json *.txt

According to the docs, I should have expected for the file to end up in the package... but it didn't, and after this screw up, I'm wondering how would I go about testing the built package against my pytest suite to make sure everything will work as expected after a build?

Upvotes: 0

Views: 49

Answers (1)

Keith
Keith

Reputation: 43024

I believe the manifest file is four source distributions. To include data files in built distributions you use the package_data option in the setup function.

setup(
    name=NAME,
    version=VERSION,
    packages=find_packages(),
    package_data={"mypackage": ["*.yaml"]},  # <- this
    test_suite="tests",
    tests_require=['pytest'],
    ...
    )

Upvotes: 1

Related Questions