File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7575 toxenv : py38-tests
7676 - name : 3.8
7777 toxenv : py38-tests_nongpl
78+ - name : 3.8
79+ toxenv : check-package-license-file
7880 exclude :
7981 # Building on Windows isn't supported, and 3.5/PyPy on Windows
8082 # seem to fail with silent obscure errors.
Original file line number Diff line number Diff line change 33_templates
44
55TODO
6+ license_report.json
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ """Test that this package's license file is properly detected by pip-licenses.
4+
5+ This file assumes that pip-licenses has already been run (in a tox env) and
6+ generated license_report.json.
7+ """
8+
9+ import json
10+ from pathlib import Path
11+
12+
13+ def main ():
14+ packages = json .loads (
15+ (Path (__file__ ).resolve ().parent / 'license_report.json' ).read_text ())
16+ for package in packages :
17+ if package ['Name' ] == 'jsonschema' :
18+ assert package ['LicenseFile' ] != 'UNKNOWN'
19+
20+
21+ if __name__ == '__main__' :
22+ main ()
Original file line number Diff line number Diff line change @@ -126,3 +126,12 @@ commands =
126126 {envpython} -m coverage run --rcfile ={toxinidir}/.coveragerc -m twisted.trial jsonschema
127127 {envpython} -m coverage xml -o {envtmpdir}/coverage.xml
128128 codecov --required --disable gcov --file {envtmpdir}/coverage.xml
129+
130+ [testenv:check-package-license-file]
131+ recreate = True
132+ deps =
133+ pip-licenses
134+ commands =
135+ pip install {toxinidir}
136+ pip-licenses --from =mixed --with-license-file --format =json --output-file ={toxinidir}/license_report.json
137+ {envpython} {toxinidir}/test_license.py
You can’t perform that action at this time.
0 commit comments