class PyLintAnalyzerTestCase(unittest.TestCase):
    def setUp(self):
        self.project = Project.objects.create(url="media/sources/fake-github.tar.gz")
        self.pylint_analyzer = PyLintAnalyzer(self.project)
        self.pylint_analyzer.get_project_modules()

    def tearDown(self):
        self.project.delete()

    def test_py_lint_analyzer_should_get_correct_config_file_when_instantiate(self):
        self.assertEquals(
            self.pylint_analyzer.config_file_path,
            os.path.join(settings.ANALYZERS_CONFIGURATION_DIR,'pylint.cfg')
        )

    def test_py_lint_analyzer_should_generate_a_text_file_with_results_output_inside_project_source_folder(self):
        project = Project.objects.get(id=self.project.id)
        self.pylint_analyzer._run_analyzer('apps')
        self.assertTrue('pylint_global.txt' in os.listdir(project.source))
        self.pylint_analyzer._remove_extracted_code()

    def test_pylint_analyzer_should_returns_processed_output_infos(self):
        self.assertAlmostEquals(-15.33, self.pylint_analyzer.analyze())
 def setUp(self):
     self.project = Project.objects.create(url="media/sources/fake-github.tar.gz")
     self.pylint_analyzer = PyLintAnalyzer(self.project)
     self.pylint_analyzer.get_project_modules()