summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-07-18 13:53:40 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-07-26 10:36:53 -0700
commitd5b96fd2d39aebce0f8ca22c37aa5a3830e1d643 (patch)
tree52b96524348a4fe1ca5051ecf178b72c37661a08 /tests
parent408724291ccd60f6cbd56208592a49badee16770 (diff)
tests: drop remaining references to twisted from unit tests
all unittests now use asyncio and the standard unittest framework.
Diffstat (limited to 'tests')
-rw-r--r--tests/commands/envelope_test.py3
-rw-r--r--tests/commands/global_test.py8
-rw-r--r--tests/commands/utils_tests.py2
-rw-r--r--tests/helper_test.py14
-rw-r--r--tests/utilities.py10
5 files changed, 13 insertions, 24 deletions
diff --git a/tests/commands/envelope_test.py b/tests/commands/envelope_test.py
index 8261da34..3efce261 100644
--- a/tests/commands/envelope_test.py
+++ b/tests/commands/envelope_test.py
@@ -20,8 +20,7 @@ import email
import os
import tempfile
import textwrap
-
-from twisted.trial import unittest
+import unittest
import mock
diff --git a/tests/commands/global_test.py b/tests/commands/global_test.py
index 2c6fd845..88c7bc99 100644
--- a/tests/commands/global_test.py
+++ b/tests/commands/global_test.py
@@ -18,8 +18,8 @@
import os
import tempfile
+import unittest
-from twisted.trial import unittest
import mock
from alot.commands import globals as g_commands
@@ -148,8 +148,8 @@ class TestComposeCommand(unittest.TestCase):
'Subject': [subject]}, cmd.envelope.headers)
self.assertEqual(body, cmd.envelope.body)
- @inlineCallbacks
- def test_single_account_no_from(self):
+ @utilities.async_test
+ async def test_single_account_no_from(self):
# issue #1277
envelope = self._make_envelope_mock()
del envelope.headers['From']
@@ -167,7 +167,7 @@ class TestComposeCommand(unittest.TestCase):
with mock.patch('alot.commands.globals.settings.get_addressbooks',
mock.Mock(side_effect=Stop)):
try:
- yield ensureDeferred(cmd.apply(mock.Mock()))
+ await cmd.apply(mock.Mock())
except Stop:
pass
diff --git a/tests/commands/utils_tests.py b/tests/commands/utils_tests.py
index cfa8a8dc..639fb1cd 100644
--- a/tests/commands/utils_tests.py
+++ b/tests/commands/utils_tests.py
@@ -17,10 +17,10 @@
import tempfile
import os
import shutil
+import unittest
import gpg
import mock
-from twisted.trial import unittest
from alot import crypto
from alot import errors
diff --git a/tests/helper_test.py b/tests/helper_test.py
index 6f0add53..b47e5eff 100644
--- a/tests/helper_test.py
+++ b/tests/helper_test.py
@@ -22,9 +22,9 @@ import email
import errno
import os
import random
+import unittest
import mock
-from twisted.trial import unittest
from alot import helper
@@ -258,7 +258,7 @@ class TestPrettyDatetime(unittest.TestCase):
self.assertEqual(actual, expected)
# Returns 'just now', instead of 'from future' or something similar
- @utilities.expected_failure
+ @unittest.expectedFailure
def test_future_minutes(self):
test = self.now + datetime.timedelta(minutes=5)
actual = helper.pretty_datetime(test)
@@ -266,7 +266,7 @@ class TestPrettyDatetime(unittest.TestCase):
self.assertEqual(actual, expected)
# Returns 'just now', instead of 'from future' or something similar
- @utilities.expected_failure
+ @unittest.expectedFailure
def test_future_hours(self):
test = self.now + datetime.timedelta(hours=1)
actual = helper.pretty_datetime(test)
@@ -274,7 +274,7 @@ class TestPrettyDatetime(unittest.TestCase):
self.assertEqual(actual, expected)
# Returns 'just now', instead of 'from future' or something similar
- @utilities.expected_failure
+ @unittest.expectedFailure
def test_future_days(self):
def make_expected():
# Uses the hourfmt instead of the hourminfmt from pretty_datetime
@@ -291,7 +291,7 @@ class TestPrettyDatetime(unittest.TestCase):
self.assertEqual(actual, expected)
# Returns 'just now', instead of 'from future' or something similar
- @utilities.expected_failure
+ @unittest.expectedFailure
def test_future_week(self):
test = self.now + datetime.timedelta(days=7)
actual = helper.pretty_datetime(test)
@@ -299,7 +299,7 @@ class TestPrettyDatetime(unittest.TestCase):
self.assertEqual(actual, expected)
# Returns 'just now', instead of 'from future' or something similar
- @utilities.expected_failure
+ @unittest.expectedFailure
def test_future_month(self):
test = self.now + datetime.timedelta(days=31)
actual = helper.pretty_datetime(test)
@@ -307,7 +307,7 @@ class TestPrettyDatetime(unittest.TestCase):
self.assertEqual(actual, expected)
# Returns 'just now', instead of 'from future' or something similar
- @utilities.expected_failure
+ @unittest.expectedFailure
def test_future_year(self):
test = self.now + datetime.timedelta(days=365)
actual = helper.pretty_datetime(test)
diff --git a/tests/utilities.py b/tests/utilities.py
index 438cb798..43f37d35 100644
--- a/tests/utilities.py
+++ b/tests/utilities.py
@@ -179,16 +179,6 @@ def make_ui(**kwargs):
return ui
-def expected_failure(func):
- """For marking expected failures for twisted.trial based unit tests.
-
- The builtin unittest.expectedFailure does not work with twisted.trail,
- there is an outstanding bug for this, but no one has ever fixed it.
- """
- func.todo = 'expected failure'
- return func
-
-
def async_test(coro):
"""Run an asyncrounous test synchronously."""