Skip to content

Commit 2245ee9

Browse files
committed
Move testing dependencies to setup.cfg
This patch moves the packages listed in `tests/requirements.txt` into `setup.cfg`. This is done to: * Reduce complexity of downstream projects that wish to inherit testing dependencies. E.g. currently the `tests/requirements.txt` file is loaded via incorporating `case-utils` as a submodule in at least two projects (`case_exiftool`, `case_gnu_time`). * Expose test requirements for supply-chain review via package metadata. The feature name is for the test requirements is `testing`, inheriting the name from Python's `setuptools`. This feature is added knowing that, once added, it should not be removed, per this best practice in the PyPA guidance: > Best practice: if a project ends up no longer needing any other > packages to support a feature, it should keep an empty requirements > list for that feature in its extras_require argument, so that packages > depending on that feature don’t break (due to an invalid feature > name). There were no effects observed on Make-managed files. References: * https://github.com/casework/CASE-Implementation-ExifTool/blob/0.5.0/tests/Makefile#L43-L45 * https://github.com/casework/CASE-Implementation-GNU-Time/blob/0.7.0/tests/Makefile#L56-L58 * https://github.com/pypa/setuptools/blob/v67.6.1/setup.cfg#L42 * https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies Signed-off-by: Alex Nelson <[email protected]>
1 parent 5259490 commit 2245ee9

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

setup.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ console_scripts =
3434
case_sparql_select = case_utils.case_sparql_select:main
3535
case_validate = case_utils.case_validate:main
3636

37+
[options.extras_require]
38+
testing =
39+
PyLD
40+
mypy
41+
pytest
42+
python-dateutil
43+
types-python-dateutil
44+
3745
[options.package_data]
3846
case_utils = py.typed
3947
case_utils.ontology =

tests/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ all: \
3131
$(top_srcdir)/.git_submodule_init.done.log \
3232
$(top_srcdir)/case_utils/__init__.py \
3333
$(top_srcdir)/setup.cfg \
34-
$(top_srcdir)/setup.py \
35-
requirements.txt
34+
$(top_srcdir)/setup.py
3635
rm -rf venv
3736
$(PYTHON3) -m venv \
3837
venv
@@ -42,14 +41,11 @@ all: \
4241
pip \
4342
setuptools \
4443
wheel
45-
source venv/bin/activate \
46-
&& pip install \
47-
--requirement requirements.txt
4844
source venv/bin/activate \
4945
&& cd $(top_srcdir) \
5046
&& pip install \
5147
--editable \
52-
.
48+
.[testing]
5349
touch $@
5450

5551
all-case_utils: \

tests/requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)