diff --git a/acme/setup.py b/acme/setup.py index 20244a7ad..9e1d838fa 100644 --- a/acme/setup.py +++ b/acme/setup.py @@ -4,7 +4,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -47,22 +46,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] - -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - - setup( name='acme', version=version, @@ -94,7 +77,4 @@ setup( 'dev': dev_extras, 'docs': docs_extras, }, - test_suite='acme', - tests_require=["pytest"], - cmdclass={"test": PyTest}, ) diff --git a/certbot-apache/setup.py b/certbot-apache/setup.py index 5ff00674c..33c1a9f9d 100644 --- a/certbot-apache/setup.py +++ b/certbot-apache/setup.py @@ -4,7 +4,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -32,21 +31,6 @@ dev_extras = [ 'apacheconfig>=0.3.2', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - - setup( name='certbot-apache', version=version, @@ -88,7 +72,4 @@ setup( 'apache = certbot_apache._internal.entrypoint:ENTRYPOINT', ], }, - test_suite='certbot_apache', - tests_require=["pytest"], - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-cloudflare/setup.py b/certbot-dns-cloudflare/setup.py index 8ae2bfafd..5d1b8cf3f 100644 --- a/certbot-dns-cloudflare/setup.py +++ b/certbot-dns-cloudflare/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -42,20 +41,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-cloudflare', version=version, @@ -97,7 +82,4 @@ setup( 'dns-cloudflare = certbot_dns_cloudflare._internal.dns_cloudflare:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_cloudflare', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-cloudxns/setup.py b/certbot-dns-cloudxns/setup.py index 37324e9fc..d776699ed 100644 --- a/certbot-dns-cloudxns/setup.py +++ b/certbot-dns-cloudxns/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -42,20 +41,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-cloudxns', version=version, @@ -97,7 +82,4 @@ setup( 'dns-cloudxns = certbot_dns_cloudxns._internal.dns_cloudxns:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_cloudxns', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-digitalocean/setup.py b/certbot-dns-digitalocean/setup.py index 1c041686e..e68a57fbc 100644 --- a/certbot-dns-digitalocean/setup.py +++ b/certbot-dns-digitalocean/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -43,20 +42,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-digitalocean', version=version, @@ -98,7 +83,4 @@ setup( 'dns-digitalocean = certbot_dns_digitalocean._internal.dns_digitalocean:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_digitalocean', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-dnsimple/setup.py b/certbot-dns-dnsimple/setup.py index 25e4fab8e..819302d49 100644 --- a/certbot-dns-dnsimple/setup.py +++ b/certbot-dns-dnsimple/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -53,20 +52,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-dnsimple', version=version, @@ -108,7 +93,4 @@ setup( 'dns-dnsimple = certbot_dns_dnsimple._internal.dns_dnsimple:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_dnsimple', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-dnsmadeeasy/setup.py b/certbot-dns-dnsmadeeasy/setup.py index 5db1354fe..5fa298572 100644 --- a/certbot-dns-dnsmadeeasy/setup.py +++ b/certbot-dns-dnsmadeeasy/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -42,20 +41,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-dnsmadeeasy', version=version, @@ -97,7 +82,4 @@ setup( 'dns-dnsmadeeasy = certbot_dns_dnsmadeeasy._internal.dns_dnsmadeeasy:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_dnsmadeeasy', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-gehirn/setup.py b/certbot-dns-gehirn/setup.py index 10797caa5..7282ce2e1 100644 --- a/certbot-dns-gehirn/setup.py +++ b/certbot-dns-gehirn/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -41,20 +40,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-gehirn', version=version, @@ -96,7 +81,4 @@ setup( 'dns-gehirn = certbot_dns_gehirn._internal.dns_gehirn:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_gehirn', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-google/setup.py b/certbot-dns-google/setup.py index f6a881784..243b5c18b 100644 --- a/certbot-dns-google/setup.py +++ b/certbot-dns-google/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -45,20 +44,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-google', version=version, @@ -100,7 +85,4 @@ setup( 'dns-google = certbot_dns_google._internal.dns_google:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_google', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-linode/setup.py b/certbot-dns-linode/setup.py index e5ea9502b..b1b124871 100644 --- a/certbot-dns-linode/setup.py +++ b/certbot-dns-linode/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -41,20 +40,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-linode', version=version, @@ -96,7 +81,4 @@ setup( 'dns-linode = certbot_dns_linode._internal.dns_linode:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_linode', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-luadns/setup.py b/certbot-dns-luadns/setup.py index 77d9578af..e9901a795 100644 --- a/certbot-dns-luadns/setup.py +++ b/certbot-dns-luadns/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -42,20 +41,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-luadns', version=version, @@ -97,7 +82,4 @@ setup( 'dns-luadns = certbot_dns_luadns._internal.dns_luadns:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_luadns', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-nsone/setup.py b/certbot-dns-nsone/setup.py index 105707e4a..3aa9b5667 100644 --- a/certbot-dns-nsone/setup.py +++ b/certbot-dns-nsone/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -42,20 +41,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-nsone', version=version, @@ -97,7 +82,4 @@ setup( 'dns-nsone = certbot_dns_nsone._internal.dns_nsone:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_nsone', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-ovh/setup.py b/certbot-dns-ovh/setup.py index 094fb0291..3f1194342 100644 --- a/certbot-dns-ovh/setup.py +++ b/certbot-dns-ovh/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -42,20 +41,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-ovh', version=version, @@ -97,7 +82,4 @@ setup( 'dns-ovh = certbot_dns_ovh._internal.dns_ovh:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_ovh', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-rfc2136/setup.py b/certbot-dns-rfc2136/setup.py index a03d565c4..2fae02860 100644 --- a/certbot-dns-rfc2136/setup.py +++ b/certbot-dns-rfc2136/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -42,20 +41,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-rfc2136', version=version, @@ -97,7 +82,4 @@ setup( 'dns-rfc2136 = certbot_dns_rfc2136._internal.dns_rfc2136:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_rfc2136', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-route53/setup.py b/certbot-dns-route53/setup.py index 041e40574..8de62fb9b 100644 --- a/certbot-dns-route53/setup.py +++ b/certbot-dns-route53/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -37,20 +36,6 @@ elif 'bdist_wheel' in sys.argv[1:]: elif sys.version_info < (3,3): install_requires.append('mock') -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-route53', version=version, @@ -90,7 +75,4 @@ setup( 'certbot-route53:auth = certbot_dns_route53.authenticator:Authenticator' ], }, - tests_require=["pytest"], - test_suite='certbot_dns_route53', - cmdclass={"test": PyTest}, ) diff --git a/certbot-dns-sakuracloud/setup.py b/certbot-dns-sakuracloud/setup.py index 94682939f..c4a04c5f3 100644 --- a/certbot-dns-sakuracloud/setup.py +++ b/certbot-dns-sakuracloud/setup.py @@ -5,7 +5,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -41,20 +40,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - setup( name='certbot-dns-sakuracloud', version=version, @@ -96,7 +81,4 @@ setup( 'dns-sakuracloud = certbot_dns_sakuracloud._internal.dns_sakuracloud:Authenticator', ], }, - tests_require=["pytest"], - test_suite='certbot_dns_sakuracloud', - cmdclass={"test": PyTest}, ) diff --git a/certbot-nginx/setup.py b/certbot-nginx/setup.py index 57f7f91c8..e505db49d 100644 --- a/certbot-nginx/setup.py +++ b/certbot-nginx/setup.py @@ -4,7 +4,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand version = '1.9.0.dev0' @@ -28,22 +27,6 @@ elif 'bdist_wheel' in sys.argv[1:]: elif sys.version_info < (3,3): install_requires.append('mock') - -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - - setup( name='certbot-nginx', version=version, @@ -82,7 +65,4 @@ setup( 'nginx = certbot_nginx._internal.configurator:NginxConfigurator', ], }, - test_suite='certbot_nginx', - tests_require=["pytest"], - cmdclass={"test": PyTest}, ) diff --git a/certbot/CHANGELOG.md b/certbot/CHANGELOG.md index 712a8757c..bfeaf327a 100644 --- a/certbot/CHANGELOG.md +++ b/certbot/CHANGELOG.md @@ -10,7 +10,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). ### Changed -* +* Update the packaging instructions to promote usage of `python -m pytest` to test Certbot + instead of the deprecated `python setup.py test` setuptools approach. ### Fixed diff --git a/certbot/docs/packaging.rst b/certbot/docs/packaging.rst index 06ae7bbff..a8fbeaa59 100644 --- a/certbot/docs/packaging.rst +++ b/certbot/docs/packaging.rst @@ -44,7 +44,7 @@ Notes for package maintainers 1. Do not package ``certbot-compatibility-test`` as it's only used internally. -2. To run tests on our packages, you should use ``python setup.py test``. Doing things like running ``pytest`` directly on our package files may not work because Certbot relies on setuptools to register and find its plugins. +2. To run tests on our packages, you should use pytest by running the command ``python -m pytest``. Running ``pytest`` directly may not work because PYTHONPATH is not handled the same way and local modules may not be found by the test runner. 3. If you'd like to include automated renewal in your package ``certbot renew -q`` should be added to crontab or systemd timer. Additionally you should include a random per-machine time offset to avoid having a large number of your clients hit Let's Encrypt's servers simultaneously. diff --git a/certbot/setup.py b/certbot/setup.py index 0edb058c5..294fc10f2 100644 --- a/certbot/setup.py +++ b/certbot/setup.py @@ -7,7 +7,6 @@ import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup -from setuptools.command.test import test as TestCommand # Workaround for http://bugs.python.org/issue8876, see # http://bugs.python.org/issue8876#msg208792 @@ -108,22 +107,6 @@ docs_extras = [ 'sphinx_rtd_theme', ] - -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = '' - - def run_tests(self): - import shlex - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - - setup( name='certbot', version=version, @@ -166,10 +149,6 @@ setup( 'docs': docs_extras, }, - test_suite='certbot', - tests_require=["pytest"], - cmdclass={"test": PyTest}, - entry_points={ 'console_scripts': [ 'certbot = certbot.main:main', diff --git a/tests/letstest/scripts/test_sdists.sh b/tests/letstest/scripts/test_sdists.sh index 05afb63dc..0f2b0ad0e 100755 --- a/tests/letstest/scripts/test_sdists.sh +++ b/tests/letstest/scripts/test_sdists.sh @@ -40,7 +40,7 @@ for pkg in acme certbot $PLUGINS; do tar -xvf "$pkg-$VERSION.tar.gz" cd "$pkg-$VERSION" python setup.py build - python setup.py test + python -m pytest python setup.py install cd - done