Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #156

Merged
merged 5 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy3]
python-version: [3.6, 3.7, 3.8, 3.9, pypy-3.6, pypy-3.7]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
Expand All @@ -26,11 +26,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox tox-gh-actions
run: pip install "tox<4" tox-gh-actions
- name: Run tox
run: tox
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2

misc:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Salmon has just had some major changes to modernise the code-base. The main
APIs should be compatible with releases prior to 3.0.0, but there's no
guarantee that older applications won't need changes.

Python versions supported are: 3.5, 3.6, 3.7 and 3.8.
Python versions supported are: 3.6, 3.7, 3.8 and 3.9.

See the CHANGELOG for more details on what's changed since Salmon version 2.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Intended Audience :: Developers',
'Topic :: Communications :: Email',
'Topic :: Software Development :: Libraries :: Application Frameworks',
Expand Down
6 changes: 5 additions & 1 deletion tests/command_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,11 @@ def test_no_connection(self):
runner = CliRunner()
result = runner.invoke(commands.main, ("blast", "--host", "127.0.1.2", "--port", "8901", "run/queue"))
self.assertEqual(result.exit_code, 1)
self.assertEqual(result.output, "Error: [Errno 111] Connection refused\n")
self.assertIn(result.output, [
# different operating systems give different errors
"Error: [Errno 111] Connection refused\n",
"Error: [Errno 60] Operation timed out\n",
])

def test_no_queue(self):
runner = CliRunner()
Expand Down
8 changes: 4 additions & 4 deletions tests/message_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def test_mail_response_attachments(self):
From="sender@localhost",
Body="Test from test_mail_response_attachments.",
)
with open("./README.rst") as file_obj:
with open("./LICENSE") as file_obj:
readme_data = file_obj.read()

with self.assertRaises(ValueError):
sample.attach(data=readme_data, disposition="inline")

sample.attach(filename="./README.rst", content_type="text/plain", disposition="inline")
sample.attach(filename="./LICENSE", content_type="text/plain", disposition="inline")
self.assertEqual(len(sample.attachments), 1)
assert sample.multipart

Expand All @@ -140,7 +140,7 @@ def test_mail_response_attachments(self):
self.assertEqual(len(sample.attachments), 0)
assert not sample.multipart

sample.attach(data=readme_data, filename="./README.rst", content_type="text/plain")
sample.attach(data=readme_data, filename="./LICENSE", content_type="text/plain")

msg = sample.to_message()
self.assertEqual(len(msg.get_payload()), 2)
Expand All @@ -162,7 +162,7 @@ def test_mail_request_attachments(self):
msg_parts = msg.all_parts()
sample_parts = sample.all_parts()

with open("./README.rst") as file_obj:
with open("./LICENSE") as file_obj:
readme = file_obj.read()

assert msg_parts[0].body == sample_parts[0].body
Expand Down
2 changes: 1 addition & 1 deletion tests/server_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def generate_mail(factory=mail.MailRequest, peer="localhost", From="from@localho
Data="body", attachment=False):
msg = factory(peer, From, To, Data)
if attachment:
msg.attach("./README.rst", content_type="text/plain", disposition="inline")
msg.attach("./LICENSE", content_type="text/plain", disposition="inline")
return msg


Expand Down
11 changes: 10 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist =
docs
lint
isort
py{35,36,37,38,39,py3}
py{36,37,38,39,py3}

[testenv]
commands =
Expand Down Expand Up @@ -54,3 +54,12 @@ skip_glob =
salmon/_version.py
versioneer.py
tests/*

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
pypy-3.6: pypy3
pypy-3.7: pypy3