Skip to content

Commit

Permalink
fix: Fix the testcase that isn't applicable to all python version. (#307
Browse files Browse the repository at this point in the history
)

* fix: Fix the testcase that isn't applicable to all python version.

* One of the test cases are testing a bug in Python stdlib that was
  fixed in 3.10 and backported to 3.9 and 3.8. This updates the
  version check to make it pass on all supported versions.
* Bump dependency on actions/setup-python@v4 to support pypy3.7
* Add dependency on 'py' to fix the non-declared dependency in
  pytest-sugar.

* Remove dependency for CI on qa

* Use pypy3.7 for testing since pypy3.6 is no longer supported

* Use pypy3.6 for testing

* revert: Re-add dependency on qa for Unit testing

* fix: some flake8 errors after rebase

* fix: update the expected response after QA fixes
  • Loading branch information
maxking committed Oct 31, 2022
1 parent e0fb197 commit 73c3a0c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/unit-testing-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
fail-fast: false
matrix:
os: [ "macos-10.15", "ubuntu-18.04", "ubuntu-20.04", "windows-latest" ]
python-version: [ "3.6", "3.7", "3.8", "3.9", "pypy3" ]
python-version: [ "3.6", "3.7", "3.8", "3.9", "pypy3.6" ]
runs-on: ${{ matrix.os }}
timeout-minutes: 15 # Slowest so far is pypy3 on MacOS, taking almost 7m
steps:
Expand All @@ -98,7 +98,7 @@ jobs:
with:
fetch-depth: 0 # Required by codecov/codecov-action@v1
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: "Install dependencies"
Expand Down
2 changes: 1 addition & 1 deletion aiosmtpd/tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def test_oserror(
if rt == (
logger_name,
logging.INFO,
"we got some refusals: {'bart@example.com': (-1, 'ignore')}",
"we got some refusals: {'bart@example.com': (-1, b'ignore')}",
):
break
else:
Expand Down
8 changes: 7 additions & 1 deletion aiosmtpd/tests/test_smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import itertools
import logging
import socket
import sys
import time
import warnings
from asyncio.transports import Transport
Expand Down Expand Up @@ -1060,7 +1061,12 @@ def test_byclient(
client.user = "goodlogin"
client.password = PW
auth_meth = getattr(client, "auth_" + mechanism)
if (mechanism, init_resp) == ("login", False):
if (mechanism, init_resp) == ("login", False) and (
sys.version_info < (3, 8, 9)
or (3, 9, 0) < sys.version_info < (3, 9, 4)):
# The bug with SMTP.auth_login was fixed in Python 3.10 and backported
# to 3.9.4 and and 3.8.9.
# See https://github.com/python/cpython/pull/24118 for the fixes.:
with pytest.raises(SMTPAuthenticationError):
client.auth(mechanism, auth_meth, initial_response_ok=init_resp)
client.docmd("*")
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ deps =
pytest-print
pytest-profiling
pytest-sugar
py # needed for pytest-sugar as it doesn't declare dependency on it.
diff_cover
setenv =
cov: COVERAGE_FILE={toxinidir}/_dump/.coverage
Expand Down

0 comments on commit 73c3a0c

Please sign in to comment.