Skip to content

Replace requirements_test.txt with a PEP 735 dependency group #270

Description

@jaysonsantos

Part of the repository modernization effort.

Background

requirements_test.txt pins test dependencies with dead environment markers:

flake8~=4.0; python_version > '2.7'
flake8~=3.9; python_version < '3.0'
mock~=4.0; python_version > '2.7'
mock~=3.0; python_version < '3.0'
pytest-cov~=3.0; python_version > '2.7'
pytest-cov~=2.0; python_version < '3.0'
pytest~=6.2; python_version > '2.7'
pytest~=4.0; python_version < '3.0'
trustme~=0.9.0

The project supports Python 3 only. Every python_version marker is dead.

mock is the PyPI backport. The standard library holds unittest.mock. The six removal issue converts the test imports.

References to the file: tox.ini:4, .ci-before-script.sh:5, AGENTS.md:16, and .travis.yml:14. .travis.yml is dead.

Proposed dependency group

Add to pyproject.toml:

[dependency-groups]
test = [
    "pytest>=7.4",
    "pytest-cov>=4.1",
    "trustme>=0.9",
]

flake8 moves out. The ruff issue owns the lint tool. mock moves out. The standard library covers it.

Warning: check the tox version

tox supports the dependency_groups directive from version 4.22. Check the installed version first.

If the installed tox is older, use one of these two options:

  1. Pin a newer tox in flake.nix and use dependency_groups = test.
  2. Keep deps = in tox.ini and list the three packages inline.

Pick option 1.

Acceptance criteria

  • pyproject.toml holds the [dependency-groups] table above.
  • requirements_test.txt is deleted.
  • tox.ini:4 uses dependency_groups = test. It no longer reads deps = -rrequirements_test.txt.
  • .ci-before-script.sh:5 installs the test group, or the file is deleted by the CI workflow issue.
  • AGENTS.md:16 states the new install command.
  • pytest -s passes locally.
  • tox passes.

Files to change

pyproject.toml, requirements_test.txt (delete), tox.ini, .ci-before-script.sh, AGENTS.md.

Order

Do the PEP 621 issue first. Do the six removal issue first. That issue removes the mock imports.

This issue and the ruff issue both change tox.ini. Merge them in sequence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    modernizationRepo modernization effortpackagingPackaging and distribution

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions