Code Climate Test Reporter failing (Python)

code-climate
python

#1

Hi Circle CI Community,

I’ve been getting false negatives for my builds where the nosetests run successfully but the code-climate-test-reporter (Python version) breaks. This seems to have about 50% of the time - sometimes it is fixed simply by rebuilding the project’s branch but it happens frequently and results in simply assuming all failed builds are this issue, not seeing the real failures when they happen (the test-reporter that cried wolf :slight_smile: I’ve liaised with Code Climate and they took a look, advising me to add this to my circle config:

test:
  post:
    - pip install requests[security]
    - codeclimate-test-reporter

However, that didn’t help either although it did yield a different stack-trace. They advised that the problem is definitely not on their side and I must follow up with you guys.

Anyone know how I might fix this? I have attached the stacktrace of the error after applying their fix but I can supply the “pre-fix” stacktrace if required.

Circle staff may be able to access such a failed build directly:
https://circleci.com/gh/Siyavula/monassis-library/571

Cheers,

Richard


#2

@RichardCochrane according to your screen print of error , problem lies with the authentication of package , see line number 1174 , your package is unable to acquire ssl connection , please go that folder try resetting the connection port . This can help to resolve your issue .


#3

Hi Devendra,

Sorry for the delay - I have to confess that I’m not sure either how to reset the port. A few articles I read on it indicate that you might be able to use fuse to do it but I’m not sure that is the issue. What I do find is that it breaks repeatedly but if I replicate just the bit where it fails with a standalone script, then it succeeds. It’s very weird. I exported the json payload to a file and when I run it either with curl or in a Python script, it succeeds. Something odd seems to come into play when the codeclimate-test-reporter runs. Do you have any ideas why it might be happening? The payload itself is not attached since I can’t attach json files but it should be available here: https://dl.dropboxusercontent.com/u/1551218/payload.json).

Curl approach:

curl -i -X POST -H "Content-Type:application/json" --data-binary "@/home/ubuntu/monassis-library/payload.json" https://codeclimate.com/test_reports

Python approach (replicating the behaving in the api_client module of codeclimate-test-reporter):

import json
import requests

with open('/home/ubuntu/monassis-library/payload.json', 'r') as file:
    payload = json.loads(file.read())

response = requests.post(
    "https://codeclimate.com/test_reports",
    data=json.dumps(payload),
    headers={"Content-Type": "application/json"})

print response.__dict__

#4