1
0
mirror of https://github.com/certbot/certbot.git synced 2025-08-06 16:42:41 +03:00

Remove deprecated python setup.py test call and update packager guide (#8262)

Fixes #7585

This PR removes the specific configuration to configure the test runner included in `setuptools` to use pytest, the deprecated parameters related to setuptools testing in `setup.py`, and update the packaging guide to use `python -m pytest` instead of `python setup.py test`.

The farm test `test_sdist.sh` is also updated to use directly pytest. This test is designed to reproduce the steps used by OS integrators when they package `certbot`, and ensure that we are not breaking something that will impact their work. We discussed with integrators from RHEL/CentOS and Debian, and they are fine with us testing sdist directly with pytest.

One execution of the `test_sdist.sh` farm test with the modifications made by this PR can be seen here: https://dev.azure.com/certbot/certbot/_build/results?buildId=2606&view=results

* Remove setuptools deprecated features about testing

* Updating packaging guide

* Add changelog entry
This commit is contained in:
Adrien Ferrand
2020-09-11 00:57:59 +02:00
committed by GitHub
parent 7ddd327f63
commit 55d411f1eb
21 changed files with 4 additions and 335 deletions

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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},
)

View File

@@ -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

View File

@@ -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.

View File

@@ -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',

View File

@@ -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