Example #1
0
def wear(args=None):
    from coveralls.control import coveralls
    from coveralls.repository import gitrepo
    from coveralls.api import post
    import logging
    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger('coveralls')
    args = args or parse_args()
    coverage = coveralls(data_file=args.data_file,
                         config_file=args.config_file)
    coverage.load()
    response = post(
        url=args.coveralls_url,
        repo_token=args.repo_token,
        service_job_id=args.service_job_id,
        service_name=args.service_name,
        git=gitrepo(args.base_dir) if not args.nogit else {},
        source_files=coverage.coveralls(args.base_dir,
                                        ignore_errors=args.ignore_errors,
                                        merge_file=args.merge_file),
        parallel=args.parallel,
    )
    logger.info(response.status_code)
    logger.info(response.text)
    return 1 if 'error' in response.json() else 0
Example #2
0
 def test_api(self):
     HTTPretty.register_uri(
         HTTPretty.POST,
         'https://coveralls.io/api/v1/jobs',
         body='{"message":"Job #5.1 - 100.0% Covered","url":"https://coveralls.io/jobs/5722"}'
     )
     response = api.post(
         url=Arguments.coveralls_url,
         repo_token=Arguments.repo_token,
         service_job_id=Arguments.service_job_id,
         service_name=Arguments.service_name,
         git=GIT_EXP,
         source_files=SOURCE_FILES
     )
     self.assertEqual(response.json(), {u'url': u'https://coveralls.io/jobs/5722', u'message': u'Job #5.1 - 100.0% Covered'})
Example #3
0
 def test_api(self):
     HTTPretty.register_uri(
         HTTPretty.POST,
         'https://coveralls.io/api/v1/jobs',
         body='{"message":"Job #5.1 - 100.0% Covered","url":"https://coveralls.io/jobs/5722"}'
     )
     response = api.post(
         url=Arguments.coveralls_url,
         repo_token=Arguments.repo_token,
         service_job_id=Arguments.service_job_id,
         service_name=Arguments.service_name,
         git=GIT_EXP,
         source_files=SOURCE_FILES
     )
     self.assertEqual(response.json(), {u'url': u'https://coveralls.io/jobs/5722', u'message': u'Job #5.1 - 100.0% Covered'})
Example #4
0
def wear(args=None):
    from coveralls.control import coveralls
    from coveralls.repository import gitrepo
    from coveralls.api import post
    args = args or parse_args()
    coverage = coveralls(data_file=args.data_file, config_file=args.config_file)
    coverage.load()
    response = post(
        url=args.coveralls_url,
        repo_token=args.repo_token,
        service_job_id=args.service_job_id,
        service_name=args.service_name,
        git=gitrepo(args.base_dir),
        source_files=coverage.coveralls(args.base_dir),
    )
    print(response.text)
    return response
Example #5
0
def wear(args=None):
    from coveralls.control import coveralls
    from coveralls.repository import gitrepo
    from coveralls.api import post
    import logging
    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger('coveralls')
    args = args or parse_args()
    coverage = coveralls(data_file=args.data_file, config_file=args.config_file)
    coverage.load()
    response = post(
        url=args.coveralls_url,
        repo_token=args.repo_token,
        service_job_id=args.service_job_id,
        service_name=args.service_name,
        git=gitrepo(args.base_dir),
        source_files=coverage.coveralls(args.base_dir, ignore_errors=args.ignore_errors),
    )
    logger.info(response.status_code)
    logger.info(response.text)
    return 1 if 'error' in response.json() else 0