Skip to content

Commit 7cfb274

Browse files
committed
Add test coverage for pyproject.toml parsing
1 parent c064894 commit 7cfb274

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ WORKDIR /srv/
77
RUN pip install twine setuptools
88

99
COPY ./requirements.txt /srv/python-third-party-license-file-generator/requirements.txt
10+
COPY ./pyproject.toml /srv/python-third-party-license-file-generator/pyproject.toml
1011

1112
RUN pip install -r /srv/python-third-party-license-file-generator/requirements.txt
1213

docker-entrypoint.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -e
44

5+
# Test parse and generation of THIRDPARTYLICENSES from requirements.txt
56
python -u -m third_party_license_file_generator \
67
-r /srv/python-third-party-license-file-generator/requirements.txt \
78
-p "$(which python)" \
@@ -16,3 +17,24 @@ if ! test -e THIRDPARTYLICENSES; then
1617
fi
1718

1819
python3 /srv/python-third-party-license-file-generator/check_third_party_licenses.py
20+
21+
rm THIRDPARTYLICENSES
22+
23+
# Test parse and generation of THIRDPARTYLICENSES from pyproject.toml (if Python version is 3.x)
24+
if python -c "import sys; sys.exit(0 if sys.version_info.major >= 3 else 1)" 2>/dev/null
25+
then
26+
python -u -m third_party_license_file_generator \
27+
-r /srv/python-third-party-license-file-generator/pyproject.toml \
28+
-p "$(which python)" \
29+
--do-not-skip-not-required-packages \
30+
--permit-gpl \
31+
--skip-prefix twine
32+
33+
if ! test -e THIRDPARTYLICENSES; then
34+
echo "error: couldn't find THIRDPARTYLICENSES- something has gone badly wrong"
35+
36+
exit 1
37+
fi
38+
39+
python3 /srv/python-third-party-license-file-generator/check_third_party_licenses.py
40+
fi

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[project]
2+
name = "python-third-party-license-file-generator"
3+
version = "0.1.0"
4+
description = "The Python third_party_license_file_generator is aimed at distilling down the appropriate license for one or many pip \"requirements\" files into a single file; it supports Python2.7 and Python3."
5+
readme = "README.md"
6+
requires-python = ">=3.9"
7+
dependencies = [
8+
"dom-toml>=2.1.0 ; python_full_version >= '3'",
9+
"pyyaml<5.4 ; python_full_version < '3'",
10+
"pyyaml>=5.4 ; python_full_version >= '3'",
11+
"requests>=2.25 ; python_full_version < '3'",
12+
"requests>=2.25 ; python_full_version >= '3'",
13+
]

0 commit comments

Comments
 (0)