mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +01:00
Fixed tests
This commit is contained in:
parent
c67963fcb9
commit
bb291b3d74
4 changed files with 27 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ node_modules
|
|||
*.egg-info
|
||||
*.pyc
|
||||
*.tgz
|
||||
Pipfile.lock
|
4
Makefile
4
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
|
||||
|
|
18
Pipfile
Normal file
18
Pipfile
Normal file
|
@ -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
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue