diff options
author | Julian Berman <Julian@GrayVines.com> | 2020-01-25 21:29:50 -0500 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2020-01-25 21:33:30 -0500 |
commit | 9cc0712e302cdbbbd36c2f57791c8a714b7646a8 (patch) | |
tree | 0fcd6392970caa00510f5d1acc4d474e18e02113 | |
parent | d4ec33ddf2094255fcdf7292f999662162616002 (diff) | |
download | jsonschema-9cc0712e302cdbbbd36c2f57791c8a714b7646a8.tar.gz |
Test directly with pip show.
Also move it into the regular test suite.
-rw-r--r-- | .github/workflows/ci.yml | 2 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | COPYING (renamed from LICENSE) | 0 | ||||
-rw-r--r-- | jsonschema/tests/test_cli.py | 7 | ||||
-rw-r--r-- | setup.cfg | 3 | ||||
-rw-r--r-- | test_license.py | 22 | ||||
-rw-r--r-- | tox.ini | 9 |
7 files changed, 8 insertions, 36 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64cdf06..84df994 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,8 +75,6 @@ jobs: toxenv: py38-tests - name: 3.8 toxenv: py38-tests_nongpl - - name: 3.8 - toxenv: check-package-license-file exclude: # Building on Windows isn't supported, and 3.5/PyPy on Windows # seem to fail with silent obscure errors. @@ -3,4 +3,3 @@ _static _templates TODO -license_report.json diff --git a/jsonschema/tests/test_cli.py b/jsonschema/tests/test_cli.py index ed3b5c1..6cb999f 100644 --- a/jsonschema/tests/test_cli.py +++ b/jsonschema/tests/test_cli.py @@ -142,6 +142,13 @@ class TestCLI(TestCase): self.assertEqual(stderr.getvalue(), "1 - 9\t1 - 8\t2 - 7\t") self.assertEqual(exit_code, 1) + def test_license(self): + output = subprocess.check_output( + [sys.executable, "-m", "pip", "show", "jsonschema"], + stderr=subprocess.STDOUT, + ) + self.assertIn("License: MIT\n", output) + def test_version(self): version = subprocess.check_output( [sys.executable, "-m", "jsonschema", "--version"], @@ -8,8 +8,7 @@ long_description = file: README.rst long_description_content_type = text/x-rst author = Julian Berman author_email = Julian@GrayVines.com -license_files = - LICENSE +license = MIT classifiers = Development Status :: 5 - Production/Stable Intended Audience :: Developers diff --git a/test_license.py b/test_license.py deleted file mode 100644 index fd1f427..0000000 --- a/test_license.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -"""Test that this package's license file is properly detected by pip-licenses. - -This file assumes that pip-licenses has already been run (in a tox env) and -generated license_report.json. -""" - -import json -from pathlib import Path - - -def main(): - packages = json.loads( - (Path(__file__).resolve().parent / 'license_report.json').read_text()) - for package in packages: - if package['Name'] == 'jsonschema': - assert package['LicenseFile'] != 'UNKNOWN' - - -if __name__ == '__main__': - main() @@ -128,12 +128,3 @@ commands = {envpython} -m coverage run --rcfile={toxinidir}/.coveragerc -m twisted.trial jsonschema {envpython} -m coverage xml -o {envtmpdir}/coverage.xml codecov --required --disable gcov --file {envtmpdir}/coverage.xml - -[testenv:check-package-license-file] -recreate = True -deps = - pip-licenses -commands = - pip install {toxinidir} - pip-licenses --from=mixed --with-license-file --format=json --output-file={toxinidir}/license_report.json - {envpython} {toxinidir}/test_license.py |