`test` vs. `tests`
Should tests live in directory test or tests? The guide seems inconsistent to me, but I'm new to contemporary Python packaging, so I may have missed something.
It is test in guides/using-manifest-in.rst:
How files are included in an sdist
The following files are included in a source distribution by default:
- ...
- all files matching the pattern
test/test*.py
and tests in tutorials/packaging-projects.rst:
Creating a test directory
tests/is a placeholder for test files. Leave it empty for now.
Is tests always the expected name for the directory containing tests? Could/should the guide standardize on that?
I think you're right, using the plural tests/ is more common. The name is not restricted programmatically, but it is nicer to have a unified convention. So far, I've only seen one project using a singular test/ folder, but they are moving toward tests/ where possible, too.
The name has to be matched/restricted at some point:
The following files are included in a source distribution by default:
- ...
- all files matching the pattern
test/test*.py
I cannot find the relevant code in the pypa repositories, as I don't know which package would do the matching.
The pypa repositories seem to be commonly using test/.
I think I have found the relevant source code in setuptools:
setuptools/_distutils/command/sdist.py Lines 295 to 296 in 59ee498
def _add_defaults_optional(self):
optional = ['test/test*.py', 'setup.cfg']
copied over from distutils:
distutils/command/sdist.py Lines 295 to 296 in e0787fa
def _add_defaults_optional(self):
optional = ['test/test*.py', 'setup.cfg']
I have created https://github.com/pypa/distutils/issues/187 to investigate directly in distutils.