def test_call_linter_with_deleted_migrations(self):
        cmd = '{0} --no-cache {1} 154ecf6119325cc3b1f3f5a4e709bfbd61a4a4ba'.format(
            self.linter_exec, fixtures.DELETED_MIGRATION_PROJECT)
        fixtures.prepare_git_project(fixtures.DELETED_MIGRATION_PROJECT)

        process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
        process.wait()
        self.assertEqual(process.returncode, 0)
        lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
        self.assertEqual(len(lines), 3)
        self.assertTrue(lines[0].endswith('OK'))
        self.assertTrue(lines[1].startswith('*** Summary'))
    def test_call_linter_cmd_line_git_id(self):
        cmd = '{0} --no-cache {1} d7125d5f4f0cc9623f670a66c54f131acc50032d'.format(
            self.linter_exec, fixtures.MULTI_COMMIT_PROJECT)
        fixtures.prepare_git_project(fixtures.MULTI_COMMIT_PROJECT)

        process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
        process.wait()
        self.assertEqual(process.returncode, 0)
        lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
        self.assertEqual(len(lines), 3)
        self.assertTrue(lines[0].endswith('OK'))
        self.assertTrue(lines[1].startswith('*** Summary'))
    def test_call_project_non_git_root(self):
        # could use tag: version_ok (but doesn't work in Travis)
        cmd = '{0} --no-cache {1} 2c46f438a89972f9ce2d5151a825a5bfb7f7db4b'.format(
            self.linter_exec, fixtures.NON_GIT_ROOT_DJANGO_PROJECT)
        fixtures.prepare_git_project(fixtures.NON_GIT_ROOT_GIT_FOLDER)

        process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
        process.wait()
        self.assertEqual(process.returncode, 0)
        lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
        self.assertEqual(len(lines), 3)
        self.assertTrue(lines[0].endswith('OK'))
        self.assertTrue(lines[1].startswith('*** Summary'))
    def test_call_project_non_git_root_ko(self):
        # could use tag: version_ko (but doesn't work in Travis)
        cmd = '{0} --no-cache {1} 0140e142724fc58944797f9ddc2ebf964146339a'.format(
            self.linter_exec, fixtures.NON_GIT_ROOT_DJANGO_PROJECT)
        fixtures.prepare_git_project(fixtures.NON_GIT_ROOT_GIT_FOLDER)

        process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
        process.wait()
        self.assertNotEqual(process.returncode, 0)
        lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
        self.assertEqual(len(lines), 5)
        self.assertTrue(lines[0].endswith('ERR'))
        self.assertTrue(lines[2].endswith('OK'))
        self.assertTrue(lines[3].startswith('*** Summary'))
Beispiel #5
0
 def test_specify_git_hash_by_commit_hash(self):
     test_project_path = fixtures.MULTI_COMMIT_PROJECT
     fixtures.prepare_git_project(test_project_path)
     self._test_linter_finds_no_errors(
         test_project_path,
         commit_id='d7125d5f4f0cc9623f670a66c54f131acc50032d')
Beispiel #6
0
 def test_no_specify_git_hash(self):
     test_project_path = fixtures.MULTI_COMMIT_PROJECT
     fixtures.prepare_git_project(test_project_path)
     self._test_linter_finds_errors(test_project_path, commit_id=None)
Beispiel #7
0
 def test_detect_git_project(self):
     project_path = fixtures.MULTI_COMMIT_PROJECT
     fixtures.prepare_git_project(project_path)
     self.assertTrue(is_git_project(project_path))