6

I'm trying to build a package for a django application, but excluding all tests modules. I have tried setting

exclude = ["*.tests", "*.tests.*", "tests.*", "tests"]

on find_packages and defining a MANIFEST.in, but the tests are always compiled and included in the bundle.

Any clues?

Rik Poggi
  • 28,332
  • 6
  • 65
  • 82
Marcio Cruz
  • 2,012
  • 1
  • 23
  • 30

2 Answers2

1

I found the combination both adding find_packages rule and writing out MANIFEST.in rules i.e. prune tests

Note that for python 3.2 and older you must have __init__.py in tests root, for find_packages command to consider tests folder to be a package.

Sample find_packages exclude command in setup.py

 packages=find_packages(
    exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),

Sample MANIFEST.in

 include *.txt *.ini *.cfg *.rst
 recursive-include fmcc *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
 prune tests
maxkoryukov
  • 4,205
  • 5
  • 33
  • 54
Alex Volkov
  • 2,812
  • 23
  • 27
0

Can I asked...did you try:

find_packages(exclude=['tests'])

user590028
  • 11,364
  • 3
  • 40
  • 57