mirror of
https://github.com/ejwa/gitinspector.git
synced 2025-03-26 02:01:27 +01:00
More tests
This commit is contained in:
parent
c52bd200db
commit
9956e7684e
2 changed files with 39 additions and 4 deletions
|
@ -103,9 +103,9 @@ class Runner(object):
|
|||
|
||||
|
||||
def __check_python_version__():
|
||||
if sys.version_info < (2, 6):
|
||||
if sys.version_info < (3, 6):
|
||||
python_version = str(sys.version_info[0]) + "." + str(sys.version_info[1])
|
||||
sys.exit(_("gitinspector requires at least Python 2.6 to run (version {0} was found).").format(python_version))
|
||||
sys.exit(_("gitinspector requires at least Python 3.6 to run (version {0} was found).").format(python_version))
|
||||
|
||||
|
||||
def __get_validated_git_repos__(repos_relative):
|
||||
|
@ -127,10 +127,10 @@ def __get_validated_git_repos__(repos_relative):
|
|||
return repos
|
||||
|
||||
|
||||
def main():
|
||||
def main(argv=None):
|
||||
terminal.check_terminal_encoding()
|
||||
terminal.set_stdin_encoding()
|
||||
argv = terminal.convert_command_line_to_utf8()
|
||||
argv = terminal.convert_command_line_to_utf8() if argv is None else argv
|
||||
run = Runner()
|
||||
repos = []
|
||||
|
||||
|
|
35
tests/test_gitinspector.py
Normal file
35
tests/test_gitinspector.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
import unittest
|
||||
import json
|
||||
import pytest
|
||||
from gitinspector import gitinspector
|
||||
|
||||
TEST_STRING = 'arbitrary'
|
||||
|
||||
|
||||
class TestGitInspector(unittest.TestCase):
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def capsys(self, capsys):
|
||||
self.capsys = capsys
|
||||
|
||||
def test_Runner(self):
|
||||
test_runner = gitinspector.Runner()
|
||||
expected_attrs = {
|
||||
"hard": False,
|
||||
"include_metrics": False,
|
||||
"list_file_types": False,
|
||||
"localize_output": False,
|
||||
"responsibilities": False,
|
||||
"grading": False,
|
||||
"timeline": False,
|
||||
"useweeks": False
|
||||
}
|
||||
for key, val in expected_attrs.items():
|
||||
self.assertEqual(getattr(test_runner, key), val)
|
||||
|
||||
def test_main(self):
|
||||
self.maxDiff = None
|
||||
gitinspector.main()
|
||||
out, err = self.capsys.readouterr()
|
||||
json.loads(out)
|
||||
self.assertEqual(err, '')
|
Loading…
Add table
Reference in a new issue