Skip to content

Commit

Permalink
Add support for Python 3.7 (#47)
Browse files Browse the repository at this point in the history
Original patch by Miro Hrončok. See https://bugzilla.redhat.com/show_bug.cgi\?id\=1605884
  • Loading branch information
Jenselme authored and twolfson committed Mar 23, 2019
1 parent 10c5a95 commit 5cbf362
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
@@ -1,8 +1,11 @@
language: python
dist: xenial
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"

install:
# Install `restructuredtext_lint`
Expand Down
22 changes: 11 additions & 11 deletions restructuredtext_lint/test/test.py
Expand Up @@ -9,12 +9,12 @@
import restructuredtext_lint


__dir__ = os.path.dirname(os.path.abspath(__file__))
valid_rst = os.path.join(__dir__, 'test_files', 'valid.rst')
warning_rst = os.path.join(__dir__, 'test_files', 'second_short_heading.rst')
dir_rst = os.path.join(__dir__, 'test_files', 'dir')
invalid_rst = os.path.join(__dir__, 'test_files', 'invalid.rst')
rst_lint_path = os.path.join(__dir__, os.pardir, 'cli.py')
_dir = os.path.dirname(os.path.abspath(__file__))
valid_rst = os.path.join(_dir, 'test_files', 'valid.rst')
warning_rst = os.path.join(_dir, 'test_files', 'second_short_heading.rst')
dir_rst = os.path.join(_dir, 'test_files', 'dir')
invalid_rst = os.path.join(_dir, 'test_files', 'invalid.rst')
rst_lint_path = os.path.join(_dir, os.pardir, 'cli.py')

"""
# TODO: Implement this as a class (options) with a sugar function that lints a string against a set of options
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_raises_on_invalid_rst(self):

def test_encoding_utf8(self):
"""A document with utf-8 characters is valid."""
filepath = os.path.join(__dir__, 'test_files', 'utf8.rst')
filepath = os.path.join(_dir, 'test_files', 'utf8.rst')
errors = restructuredtext_lint.lint_file(filepath, encoding='utf-8')
self.assertEqual(errors, [])

Expand All @@ -67,7 +67,7 @@ def test_second_heading_short_line_number(self):
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/5
"""
filepath = os.path.join(__dir__, 'test_files', 'second_short_heading.rst')
filepath = os.path.join(_dir, 'test_files', 'second_short_heading.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertEqual(errors[0].line, 6)
self.assertEqual(errors[0].source, filepath)
Expand All @@ -77,7 +77,7 @@ def test_invalid_target(self):
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/6
"""
filepath = os.path.join(__dir__, 'test_files', 'invalid_target.rst')
filepath = os.path.join(_dir, 'test_files', 'invalid_target.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertIn('Unknown target name', errors[0].message)

Expand All @@ -86,7 +86,7 @@ def test_invalid_line_mismatch(self):
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/7
"""
filepath = os.path.join(__dir__, 'test_files', 'invalid_line_mismatch.rst')
filepath = os.path.join(_dir, 'test_files', 'invalid_line_mismatch.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertIn('Title overline & underline mismatch', errors[0].message)

Expand All @@ -95,7 +95,7 @@ def test_invalid_link(self):
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/12
"""
filepath = os.path.join(__dir__, 'test_files', 'invalid_link.rst')
filepath = os.path.join(_dir, 'test_files', 'invalid_link.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertIn('Anonymous hyperlink mismatch: 1 references but 0 targets.', errors[0].message)
self.assertIn('Hyperlink target "hello" is not referenced.', errors[1].message)
Expand Down

0 comments on commit 5cbf362

Please sign in to comment.