diff --git a/.gitignore b/.gitignore index b6f142c..36fd532 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ node_modules *.egg-info *.pyc *.tgz +Pipfile.lock \ No newline at end of file diff --git a/Makefile b/Makefile index ee6eca3..5c33056 100644 --- a/Makefile +++ b/Makefile @@ -31,9 +31,7 @@ clean-pyc: ## remove Python file artifacts find . -name '__pycache__' -exec rm -fr {} + clean-test: ## remove test and coverage artifacts - rm -fr .tox/ rm -f .coverage - rm -fr htmlcov/ rm -fr .pytest_cache lint: ## check style with flake8 @@ -42,7 +40,7 @@ lint: ## check style with flake8 flake8 gitinspector tests --max-line-length=120 test: ## run tests quickly with the default Python - py.test + pytest test-debug: ## run tests with debugging enabled LOGLEVEL=debug; py.test -s --pdb diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..57a574a --- /dev/null +++ b/Pipfile @@ -0,0 +1,18 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] + +[dev-packages] +pytest = "*" +flake8 = "*" +autopep8 = "*" +black = "*" + +[requires] +python_version = "3.8" + +[pipenv] +allow_prereleases = true diff --git a/tests/test_comment.py b/tests/test_comment.py index afbe483..8e495bc 100644 --- a/tests/test_comment.py +++ b/tests/test_comment.py @@ -20,7 +20,7 @@ from __future__ import unicode_literals import os import sys -import unittest2 +import unittest import gitinspector.comment def __test_extension__(commented_file, extension): @@ -32,19 +32,18 @@ def __test_extension__(commented_file, extension): is_inside_comment = False comment_counter = 0 for i in tex: - i = i.decode("utf-8", "replace") (_, is_inside_comment) = gitinspector.comment.handle_comment_block(is_inside_comment, extension, i) if is_inside_comment or gitinspector.comment.is_comment(extension, i): comment_counter += 1 return comment_counter -class TexFileTest(unittest2.TestCase): +class TexFileTest(unittest.TestCase): def test(self): - comment_counter = __test_extension__("/resources/commented_file.tex", "tex") - self.assertEqual(comment_counter, 30) + comment_counter = __test_extension__("/resources/commented_file.tex", "tex") + self.assertEqual(comment_counter, 30) -class CppFileTest(unittest2.TestCase): +class CppFileTest(unittest.TestCase): def test(self): - comment_counter = __test_extension__("/resources/commented_file.cpp", "cpp") - self.assertEqual(comment_counter, 25) + comment_counter = __test_extension__("/resources/commented_file.cpp", "cpp") + self.assertEqual(comment_counter, 25)