twine icon indicating copy to clipboard operation
twine copied to clipboard

Add missing docstrings to tests

Open bhrutledge opened this issue 4 years ago • 4 comments

Inspired by https://hynek.me/articles/document-your-tests/ and https://jml.io/pages/test-docstrings.html, I think there's an opportunity to write test docstrings that provide value to future contributors. However, I see this as lower-priority than #635.

I recommend doing these in small batches, and reviewing the patterns already in use for the existing docstrings. I don't yet have a style guide in mind (beyond what's enforced by flake8-docstrings); maybe that will emerge as part of this work.

Count per error code:

$ flake8 -qq --per-file-ignores= --select=D1 --statistics tests
13    D100 Missing docstring in public module
2     D101 Missing docstring in public class
15    D102 Missing docstring in public method
69    D103 Missing docstring in public function
1     D104 Missing docstring in public package

Count per file:

$ flake8 --per-file-ignores= --select=D1 tests | grep -oE '^.*\.py\b' | sort | uniq -c
   1 tests/__init__.py
  15 tests/conftest.py
  15 tests/test_auth.py
  11 tests/test_check.py
   3 tests/test_cli.py
   6 tests/test_commands.py
   4 tests/test_integration.py
   2 tests/test_main.py
   8 tests/test_package.py
   1 tests/test_register.py
   3 tests/test_repository.py
   4 tests/test_settings.py
  12 tests/test_upload.py
  10 tests/test_utils.py
   5 tests/test_wheel.py

bhrutledge avatar May 27 '20 10:05 bhrutledge

@bhrutledge I will work on this issue.

dukecat0 avatar Aug 01 '21 07:08 dukecat0

Thanks @meowmeowmeowcat. If you're so inclined, I think it'd be more valuable to work on adding docstrings to the source, via #635. But if you prefer tests, go for it.

bhrutledge avatar Aug 01 '21 09:08 bhrutledge

Oh, I see. I'll work on #635 first, then this issue.

dukecat0 avatar Aug 01 '21 09:08 dukecat0

Any PRs for this issue should remove the relevant per-file-ignores entry in https://github.com/pypa/twine/blob/main/.flake8.

bhrutledge avatar Aug 18 '21 01:08 bhrutledge