Skip to content

Commit

Permalink
Make acme tests internal (#9625)
Browse files Browse the repository at this point in the history
This is a first step towards implementing the plan I described at #7909 (comment) which got a +1 from both Erica and Will. Similar changes for our other packages will be made in followup PRs to try and make this easier to review.

It may be helpful to look at #7600 when reviewing this PR where we did something similar in the past.

The value of `ignore-paths` in `.pylintrc` should work on Windows based on https://pylint.readthedocs.io/en/latest/user_guide/configuration/all-options.html#ignore-paths and the fact that on macOS/linux, changing path delimiters to `\` still causes these directories to be ignored.

I started testing this for mypy as well, but mypy doesn't current pass for us on Windows so I didn't bother and took this opportunity to remove it from the default environments in `tox.ini`. I'll update #7803 to mention that the value of `exclude` in `mypy.ini` may need to be tweaked if anyone works on that issue.

* make acme tests internal

* no mypy-win
  • Loading branch information
bmw committed Mar 28, 2023
1 parent e10e549 commit 6832521
Show file tree
Hide file tree
Showing 47 changed files with 20 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ ignore=CVS
# ignore-list. The regex matches against paths and can be in Posix or Windows
# format. Because '\' represents the directory delimiter on Windows systems, it
# can't be used as an escape character.
ignore-paths=
# CERTBOT COMMENT
# Changing this line back to the default of `ignore-paths=` is being tracked by
# https://github.com/certbot/certbot/issues/7908.
ignore-paths=.*/_internal/tests/

# Files or directories matching the regular expression patterns are skipped.
# The regex matches against base names, not paths. The default value ignores
Expand Down
2 changes: 1 addition & 1 deletion acme/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include README.rst
include pytest.ini
recursive-include docs *
recursive-include examples *
recursive-include tests *
recursive-include acme/_internal/tests/testdata *
include acme/py.typed
global-exclude __pycache__
global-exclude *.py[cod]
1 change: 1 addition & 0 deletions acme/acme/_internal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""acme's internal implementation"""
1 change: 1 addition & 0 deletions acme/acme/_internal/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""acme tests"""
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import requests

from acme import errors
import test_util
from acme._internal.tests import test_util

CERT = test_util.load_comparable_cert('cert.pem')
KEY = jose.JWKRSA(key=test_util.load_rsa_private_key('rsa512_key.pem'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
from acme import errors
from acme import jws as acme_jws
from acme import messages
from acme._internal.tests import messages_test
from acme._internal.tests import test_util
from acme.client import ClientNetwork
from acme.client import ClientV2
import messages_test
import test_util

CERT_SAN_PEM = test_util.load_vector('cert-san.pem')
CSR_MIXED_PEM = test_util.load_vector('csr-mixed.pem')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pytest

from acme import errors
import test_util
from acme._internal.tests import test_util


class SSLSocketAndProbeSNITest(unittest.TestCase):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import josepy as jose
import pytest

import test_util
from acme._internal.tests import test_util

KEY = jose.JWKRSA.load(test_util.load_vector('rsa512_key.pem'))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import pytest

from acme import challenges
import test_util
from acme._internal.tests import test_util

CERT = test_util.load_comparable_cert('cert.der')
CSR = test_util.load_comparable_csr('csr.der')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from acme import challenges
from acme import crypto_util
from acme import errors
import test_util
from acme._internal.tests import test_util


class TLSServerTest(unittest.TestCase):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[mypy]
# Removing this exclude setting is being tracked by
# https://github.com/certbot/certbot/issues/7909.
exclude = .*/_internal/tests/
ignore_missing_imports = True
warn_unused_ignores = True
show_error_codes = True
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

[tox]
skipsdist = true
envlist = {cover,lint,mypy}-{win,posix}
# mypy doesn't current pass for us on Windows. Fixing that is being tracked by
# https://github.com/certbot/certbot/issues/7803.
envlist = {cover,lint}-{win,posix},mypy-posix

[base]
# pip installs the requested packages in editable mode
Expand Down

0 comments on commit 6832521

Please sign in to comment.