Skip to content

Commit

Permalink
Replace testtools/nose with pytest (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Nov 10, 2021
1 parent 6d93e18 commit 721e1c1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
14 changes: 6 additions & 8 deletions doc8/tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import unittest
import tempfile

import testtools

from doc8 import checks
from doc8 import parser


class TestTrailingWhitespace(testtools.TestCase):
class TestTrailingWhitespace(unittest.TestCase):
def test_trailing(self):
lines = ["a b ", "ab"]
check = checks.CheckTrailingWhitespace({})
Expand All @@ -34,7 +32,7 @@ def test_trailing(self):
self.assertIn(code, check.REPORTS)


class TestTabIndentation(testtools.TestCase):
class TestTabIndentation(unittest.TestCase):
def test_tabs(self):
lines = [" b", "\tabc", "efg", "\t\tc"]
check = checks.CheckIndentationNoTab({})
Expand All @@ -46,7 +44,7 @@ def test_tabs(self):
self.assertIn(code, check.REPORTS)


class TestCarriageReturn(testtools.TestCase):
class TestCarriageReturn(unittest.TestCase):
def test_cr(self):
content = b"Windows line ending\r\nLegacy Mac line ending\r"
content += (b"a" * 79) + b"\r\n" + b"\r"
Expand All @@ -62,7 +60,7 @@ def test_cr(self):
self.assertIn(code, check.REPORTS)


class TestLineLength(testtools.TestCase):
class TestLineLength(unittest.TestCase):
def test_over_length(self):
content = b"""
===
Expand Down Expand Up @@ -169,7 +167,7 @@ def test_definition_term_length(self):
self.assertEqual(0, len(errors))


class TestNewlineEndOfFile(testtools.TestCase):
class TestNewlineEndOfFile(unittest.TestCase):
def test_newline(self):
tests = [
(1, b"testing"),
Expand Down
8 changes: 4 additions & 4 deletions doc8/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from mock import patch, MagicMock
import os
from io import StringIO
import unittest
import shutil
import sys
import testtools

from doc8.main import main, doc8

Expand Down Expand Up @@ -145,7 +145,7 @@ def report(self):
return ""


class TestCommandLine(testtools.TestCase):
class TestCommandLine(unittest.TestCase):
"""
Test command line invocation
"""
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_main__no_quiet_verbose__output_is_verbose(self):
self.assertEqual(state, 1)


class TestApi(testtools.TestCase):
class TestApi(unittest.TestCase):
"""
Test direct code invocation
"""
Expand Down Expand Up @@ -226,7 +226,7 @@ def test_doc8__verbose__verbose_overridden(self):
self.assertEqual(result.total_errors, 2)


class TestArguments(testtools.TestCase):
class TestArguments(unittest.TestCase):
"""
Test that arguments are parsed correctly
"""
Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ ignore_missing_imports = True

[mypy-stevedore]
ignore_missing_imports = True

[mypy-testtools]
ignore_missing_imports = True
3 changes: 1 addition & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mock # BSD
nose # LGPL
testtools # MIT
pytest # MIT
toml # MIT
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ envlist = lint,py,docs,packaging
[testenv]
deps =
-r{toxinidir}/test-requirements.txt
commands = nosetests {posargs}
commands = pytest {posargs}
whitelist_externals =
rm

Expand Down

0 comments on commit 721e1c1

Please sign in to comment.