mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:42:02 +02:00
Automatically run test files with pytest (#9576)
* Switch to pytest
git grep -l unittest.main | xargs sed -i 's/unittest.main()/sys.exit(pytest.main([__file__]))/g'
git ls-files -m | xargs -I {} sh -c "echo 'import sys\nimport pytest' >> '{}'"
isort --float-to-top .
* add pytest dep
* use sys.argv
This commit is contained in:
@@ -33,6 +33,10 @@ docs_extras = [
|
||||
'sphinx_rtd_theme',
|
||||
]
|
||||
|
||||
test_extras = [
|
||||
'pytest',
|
||||
]
|
||||
|
||||
setup(
|
||||
name='certbot-dns-google',
|
||||
version=version,
|
||||
@@ -68,6 +72,7 @@ setup(
|
||||
install_requires=install_requires,
|
||||
extras_require={
|
||||
'docs': docs_extras,
|
||||
'test': test_extras,
|
||||
},
|
||||
entry_points={
|
||||
'certbot.plugins': [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Tests for certbot_dns_google._internal.dns_google."""
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
@@ -7,6 +8,7 @@ from googleapiclient import discovery
|
||||
from googleapiclient.errors import Error
|
||||
from googleapiclient.http import HttpMock
|
||||
from httplib2 import ServerNotFoundError
|
||||
import pytest
|
||||
|
||||
from certbot import errors
|
||||
from certbot.compat import os
|
||||
@@ -410,4 +412,4 @@ class DummyResponse:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main() # pragma: no cover
|
||||
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover
|
||||
|
||||
Reference in New Issue
Block a user