for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import json
import os
import re
import sys
import unittest
from coalib import coala_html
from coalib.misc.ContextManagers import prepare_file
from tests.TestUtilities import execute_coala
from coalib.misc import Constants
ROOT = os.path.dirname(os.path.dirname(__file__))
class coalaHTMLTest(unittest.TestCase):
def setUp(self):
self.old_argv = sys.argv
self.result_file = os.path.join(ROOT, 'coalib',
Constants.CONFIGS['results_file'])
def tearDown(self):
sys.argv = self.old_argv
def test_output_file(self):
update_file = ""
noupdate_file = ""
with prepare_file(["#todo this is todo"], None) as (lines, filename):
execute_coala(coala_html.main,
"coala-html",
"-c", os.devnull,
"-b", "LineCountBear",
"-f", re.escape(filename),
"--nolaunch")
with open(self.result_file) as fp:
update_file = json.load(fp)
"-N",
noupdate_file = json.load(fp)
self.assertEqual(update_file['results']['default'][0]['message'],
noupdate_file['results']['default'][0]['message'])