GithubHelp home page GithubHelp logo

thekevjames / coveralls-python Goto Github PK

View Code? Open in Web Editor NEW
547.0 9.0 184.0 596 KB

Show coverage stats online via coveralls.io

Home Page: coveralls-python.readthedocs.io

License: MIT License

Python 99.72% Dockerfile 0.28%
coveralls coverage pytest nosetests python

coveralls-python's People

Contributors

alex avatar arturklauser avatar asmeurer avatar caleb15 avatar cdce8p avatar coagulant avatar flacjacket avatar i386x avatar ionelmc avatar isms avatar jessamynsmith avatar jku avatar joroshiba avatar josephharrington avatar jvarho avatar maxkoryukov avatar mayn avatar mgaitan avatar nickmerwin avatar nirizr avatar pre-commit-ci[bot] avatar proofit404 avatar renovate[bot] avatar samuelcolvin avatar saraedum avatar thekevjames avatar themanwithoutaplan avatar thibaudcolas avatar vchrombie avatar xolox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coveralls-python's Issues

`coveralls debug` insists that a token is required

Running debug mode does not print out anything:

$ coveralls debug
Missing .coveralls.yml file. Using only env variables.
You have to provide either repo_token in .coveralls.yml, or launch via Travis

Since the help says it won't send anything, one would think that the repo_token is not really required.

Subprocess coverage missing

With the right configuration and some monkey patching, coverage.py supports line coverage in subprocess and multiprocessing. However, coveralls-python doesn't seems to report line covered in subprocess.

I did the necessary modification to be able to capture subprocees in spotify/luigi here spotify/luigi#827. I'm getting the right coverage with coverage.py but not coveralls.

I included the result of coveralls debug and coverage report. We can see that coverage reports higher coverage for luigi/server.py, mrrunner.py, luigi/process.

$ coveralls debug

Testing coveralls-python...
{500 kb json}
==
Reporting 40 files
==

bin/luigi - 3/7
luigi/configuration.py - 46/114
luigi/contrib/esindex.py - 108/441
luigi/contrib/hive.py - 154/454
luigi/contrib/pig.py - 78/197
luigi/contrib/rdbms.py - 27/125
luigi/contrib/redshift.py - 57/424
luigi/contrib/spark.py - 179/400
luigi/contrib/sqla.py - 106/376
luigi/contrib/ssh.py - 124/264
luigi/contrib/target.py - 31/75
luigi/date_interval.py - 113/272
luigi/db_task_history.py - 96/199
luigi/deprecate_kwarg.py - 13/55
luigi/event.py - 10/31
luigi/file.py - 73/147
luigi/format.py - 275/518
luigi/hadoop.py - 387/940
luigi/hdfs.py - 373/964
luigi/hive.py - 4/28
luigi/interface.py - 195/448
luigi/lock.py - 34/97
luigi/mock.py - 84/170
luigi/notifications.py - 72/193
luigi/parameter.py - 204/556
luigi/postgres.py - 115/346
luigi/process.py - 18/183
luigi/rpc.py - 70/163
luigi/s3.py - 238/561
luigi/scheduler.py - 514/908
luigi/server.py - 82/195
luigi/target.py - 56/241
luigi/task.py - 251/749
luigi/task_history.py - 24/75
luigi/task_status.py - 8/28
luigi/tools/parse_task.py - 18/69
luigi/tools/range.py - 205/510
luigi/util.py - 101/243
luigi/worker.py - 439/787
mrrunner.py - 37/97
$ coverage report

Name                     Stmts   Miss  Cover
--------------------------------------------
bin/luigi                    3      0   100%
luigi/configuration         52      6    88%
luigi/contrib/esindex      129     21    84%
luigi/contrib/hive         244     90    63%
luigi/contrib/pig          107     29    73%
luigi/contrib/rdbms         36      9    75%
luigi/contrib/redshift     134     77    43%
luigi/contrib/spark        276     97    65%
luigi/contrib/sqla         112      6    95%
luigi/contrib/ssh          136     12    91%
luigi/contrib/target        31      0   100%
luigi/date_interval        135     22    84%
luigi/db_task_history      109     13    88%
luigi/deprecate_kwarg       15      2    87%
luigi/event                 10      0   100%
luigi/file                  83     10    88%
luigi/format               314     39    88%
luigi/hadoop               532    145    73%
luigi/hdfs                 489    116    76%
luigi/hive                   4      0   100%
luigi/interface            202      7    97%
luigi/lock                  38      4    89%
luigi/mock                  95     11    88%
luigi/notifications        100     28    72%
luigi/parameter            214     10    95%
luigi/postgres             135     20    85%
luigi/process              103     85    17%
luigi/rpc                   78      8    90%
luigi/s3                   286     48    83%
luigi/scheduler            536     22    96%
luigi/server                98     16    84%
luigi/target                65      9    86%
luigi/task                 272     21    92%
luigi/task_history          27      3    89%
luigi/task_status            8      0   100%
luigi/tools/parse_task      18      0   100%
luigi/tools/range          215     10    95%
luigi/util                 102      1    99%
luigi/worker               473     34    93%
mrrunner                    46      9    80%
--------------------------------------------
TOTAL                     6062   1040    83%

Token does not appear to be sent to Coveralls

Hi

Thanks for your client library that makes it super easy for us to use python with coveralls.

Unfortunately I am not able the final step of sending coverage data to coveralls to work.
I reported this issue at lemurheavy/coveralls-public#449.

Coveralls suggested that my repo token isn't getting sent? I am using Codeship and am using a COVERALLS_REPO_TOKEN env variable. I do not have a .coveralls.yml file as I am using an env variable.

Am I doing something wrong?

Submitting reports fails under PyPy unless certain coverage excludes are provided

In the pypy environment on Travis-CI, the coveralls command errors out under PyPy while trying to retrieve source for PyPy files which have no source.

Here's the traceback for one file (though, if you exclude that one, you get an error for another):

Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "/home/travis/virtualenv/pypy/bin/coveralls", line 31, in <module>
    result = coverallz.wear()
  File "/home/travis/virtualenv/pypy/site-packages/coveralls/api.py", line 66, in wear
    data = self.create_data()
  File "/home/travis/virtualenv/pypy/site-packages/coveralls/api.py", line 98, in create_data
    self._data = {'source_files': self.get_coverage()}
  File "/home/travis/virtualenv/pypy/site-packages/coveralls/api.py", line 108, in get_coverage
    return reporter.report()
  File "/home/travis/virtualenv/pypy/site-packages/coveralls/reporter.py", line 15, in report
    self.report_files(self.parse_file, morfs)
  File "/home/travis/virtualenv/pypy/site-packages/coverage/report.py", line 84, in report_files
    report_fn(cu, self.coverage._analyze(cu))
  File "/home/travis/virtualenv/pypy/site-packages/coverage/control.py", line 545, in _analyze
    return Analysis(self, it)
  File "/home/travis/virtualenv/pypy/site-packages/coverage/results.py", line 24, in __init__
    raise NoSource("No source for code: '%s'" % self.filename)
NoSource: No source for code: '/home/buildslave/bot64/pypy-c-jit-linux-x86-64/build/lib-python/2.7/_abcoll.py'

However, this doesn't stop the regular coverage report from being generated by coverage.py as you can see if you look at the Travis-CI build which I took that traceback from:

https://travis-ci.org/ssokolow/snakebyte/jobs/6789898

My workaround was to add this to my omit key in .coveragerc:

    */lib_pypy/_*.py

Coveralls and Tox 2.0

I just found out today, that with the new tox release (https://testrun.org/tox/latest/changelog.html#id1), coveralls stops working on travis.
The reason is that tox 2.0 has environment isolation. You have to pass
the TRAVIS and TRAVIS_JOB_ID and probably TRAVIS_BRANCH envvar in you tox settings or coveralls will think it is not on travis: https://testrun.org/tox/latest/example/basic.html#passing-down-environment-variables.

You can see my log on travis (scroll to the bottom): https://travis-ci.org/Pytwitcher/pytwitcherapi/jobs/62437830

The error message has become confusing, because of the tox update. My suggestion is to give a hint in the error message and state it in the documentation.

Exception handling in console client is poor

issing .coveralls.yml file. Using only env variables.
Traceback (most recent call last):
  File "/Users/prophet/.envs/680bec7fdad293b3/bin/coveralls", line 28, in <module>
    coverallz = Coveralls()
  File "/Users/prophet/.envs/680bec7fdad293b3/lib/python2.7/site-packages/coveralls/api.py", line 55, in __init__
    raise Exception('You have to provide either repo_token in %s, or launch via Travis' % self.config_filename)
Exception: You have to provide either repo_token in .coveralls.yml, or launch via Travis

Looks quite bad.

Missing 'url' key raises uncaught KeyError on coveralls.io 503 response

Could not reproduce with coveralls debug as coveralls.io had evidently fixed its server-side error by this time. Traceback from original run below:

Submitting coverage to coveralls.io...
Coverage submitted!
Failure to submit data. Response [503]: <!DOCTYPE html>
    <html>
    <head>
      <style type="text/css">
        html, body, iframe { margin: 0; padding: 0; height: 100%; }
        iframe { display: block; width: 100%; border: none; }
      </style>
    <title>Application Error</title>
    </head>
    <body>
      <iframe src="https://s3.amazonaws.com/assets.coveralls.io/maintenance.html">
        <p>Application Error</p>
      </iframe>
    </body>
    </html>
Traceback (most recent call last):
  File "/home/rof/.virtualenv/bin/coveralls", line 9, in <module>
    load_entry_point('coveralls==0.4.1', 'console_scripts', 'coveralls')()
  File "/home/rof/.virtualenv/local/lib/python2.7/site-packages/coveralls/cli.py", line 52, in main
    log.info(result['url'])
KeyError: 'url'

Support PyPy

All that may be required is to gracefully handle the NoSource exception that coverage raises. See example.

UnicodeDecodeError: 'utf8' codec can't decode byte, invalid start byte

This error appears when I want to submit my coverage report.

Traceback (most recent call last):
  File "/Users/dominik/.virtualenvs/okfn/bin/coveralls", line 9, in <module>
    load_entry_point('coveralls==0.2', 'console_scripts', 'coveralls')()
  File "/Users/dominik/Developer/okfn/coveralls-python/coveralls/cli.py", line 48, in main
    result = coverallz.wear()
  File "/Users/dominik/Developer/okfn/coveralls-python/coveralls/api.py", line 75, in wear
    json_string = json.dumps(data)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 243, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 9494: invalid start byte

Coverage file: https://dl.dropboxusercontent.com/u/12770094/.coverage

Couldn't find a repository matching this job.

I am seeing the following error message in my travis-ci logs:

$ coveralls
Submitting coverage to coveralls.io...
Coverage submitted!
Couldn't find a repository matching this job.
'url'

Dealing with Multiple Coverage Results

My repos is laid out as:

/
/.travis.yml
/projects/
         /p1
         /p2
         /p3

and I am running: coverage run --source="." ./manage.py test from within each each of the projects folders (i.e. a .coverage file is created within p1, p2 and p3).

How do I take these coverage files, merge them and submit to coveralls also making sure the paths are correct?

No files reported on Travis

My Travis build is reporting 0 files when I use coveralls debug There's an example at the bottom of this build:

https://travis-ci.org/Axelrod-Python/Axelrod/builds/62563230

When I run the same coverage command locally, followed by coveralls debug I get the expected results and I can even run coveralls successfully. The result of a local run is job number 511 here:

https://coveralls.io/r/Axelrod-Python/Axelrod

The only difference between the two is that I created .coveralls.yml for my local test and entered my repo_token but my understanding was that I don't need to do that for a Travis build.

Am I missing something somewhere?

Coveralls cannot find requests in travis env `python2.7_with_system_site_packages`

For this travis job: https://travis-ci.org/datamade/dedupe/jobs/39988010#L560

Coverall's can't find requests, even though it seems to install fine from pip install coveralls

 File "/home/travis/virtualenv/python2.7_with_system_site_packages/bin/coveralls", line 5, in <module>

from pkg_resources import load_entry_point

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>

working_set.require(__requires__)

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require

needed = self.resolve(parse_requirements(requirements))

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve

raise DistributionNotFound(req)

pkg_resources.DistributionNotFound: requests>=1.0.0

This python 2.6 build works fine: https://travis-ci.org/datamade/dedupe/jobs/39988011#L700

Fix coverage submit

Not sure if this is a coveralls.io or coveralls-python issue, but on Travis everything seems to submit correctly (see below), yet on coveralls.io the commit coverage shows a questionmark.

==
Reporting 17 files
==
psiturk/__init__.py - 1/2
psiturk/__main__.py - 0/5
psiturk/amt_services.py - 0/504
psiturk/command_line.py - 0/67
psiturk/counter.py - 0/195
psiturk/db.py - 13/24
psiturk/experiment.py - 120/528
psiturk/experiment_errors.py - 12/44
psiturk/experiment_server.py - 0/65
psiturk/experiment_server_controller.py - 0/147
psiturk/models.py - 39/102
psiturk/psiturk_config.py - 22/61
psiturk/psiturk_org_services.py - 0/118
psiturk/psiturk_shell.py - 0/1430
psiturk/setup_example.py - 0/33
psiturk/user_utils.py - 18/52
psiturk/version.py - 1/2
Coverage submitted!
Job #39.1
https://coveralls.io/jobs/1412415
{u'url': u'https://coveralls.io/jobs/1412415', u'message': u'Job #39.1'}
Done. Your build exited with 0.

UnicodeDecodeError: 'utf8' codec can't decode byte 0xf3 in position 429: invalid continuation byte

From https://travis-ci.org/PyMVPA/PyMVPA/jobs/7160555

$ if [[ $MVPA_DEBUG_METRICS == all ]]; then coveralls; fi
Missing .coveralls.yml file. Using only env variables.
Submitting coverage to coveralls.io...
Traceback (most recent call last):
  File "/home/travis/.local/bin/coveralls", line 31, in <module>
    result = coverallz.wear()
  File "/home/travis/.local/lib/python2.7/site-packages/coveralls/api.py", line 67, in wear
    json_string = json.dumps(data)
  File "/usr/lib/python2.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf3 in position 429: invalid continuation byte
travis_fold:end:after_success

any advise on troubleshooting would be welcome

Coveralls merge fails when using python3

In a python3 environment, I get the following error when I try to use the --merge option:

$ coveralls --merge=coverage.json --output=op.txt Traceback (most recent call last): File "/Users/jessamyn/.virtualenvs/eggtimer/bin/coveralls", line 9, in <module> load_entry_point('coveralls==1.0a0', 'console_scripts', 'coveralls')() File "/Users/jessamyn/.virtualenvs/eggtimer/lib/python3.4/site-packages/coveralls-1.0a0-py3.4.egg/coveralls/cli.py", line 50, in main File "/Users/jessamyn/.virtualenvs/eggtimer/lib/python3.4/site-packages/coveralls-1.0a0-py3.4.egg/coveralls/api.py", line 74, in merge File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/json/__init__.py", line 268, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__))

Properly Config Inclusion/Exclusions

Hi,

I know this is probably not a good place to ask about coverage.py questions. However when I do coverage on local environment the report would not go explosive:

$ nosetests --with-coverage --cover-package=tidehunter
pycurl.error: invalid return value for write callback -1 1150
.pycurl.error: invalid return value for write callback -1 2331
..............
Name                Stmts   Miss  Cover   Missing
-------------------------------------------------
tidehunter             11      0   100%   
tidehunter.stream     139      5    96%   170-171, 215-217
-------------------------------------------------
TOTAL                 150      5    97%   
----------------------------------------------------------------------
Ran 15 tests in 1.321s

However when it's built by Travis-CI and submitted to Coveralls.io, the report is horrifying: https://coveralls.io/builds/116975

My .coveragerc and .travis.yml are all on the repository: https://github.com/amoa/tidehunter

Please help on how to properly configure coverage so the report on coveralls only shows what's intended.

Leo

The --merge option of version 0.50 seems not to be Python 3 compatible

Hi,

we have mixed C++/Python packages, that we would like to test with coverage. I have created an environment on Travis, in which we are able to integrate the coverage of the cpp-coverage package and this package, by first creating the C++ coverage, paste it into a file, and then use the --merge option of this package. Under Python 2 this is working flawlessly, as you can see here:
https://travis-ci.org/bioidiap/bob.core
and here:
https://coveralls.io/r/bioidiap/bob.core

However, under Python 3 I get the following error message:

$ coveralls --merge=cpp_cov.json
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.2.5/bin/coveralls", line 9, in <module>
load_entry_point('coveralls==0.5', 'console_scripts', 'coveralls')()
File "/home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages/coveralls/cli.py", line 50, in main
coverallz.merge(options['--merge'])
File "/home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages/coveralls/api.py", line 72, in merge
extra = json.load(fh)
File "/opt/python/3.2.5/lib/python3.2/json/__init__.py", line 274, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/opt/python/3.2.5/lib/python3.2/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/opt/python/3.2.5/lib/python3.2/json/decoder.py", line 353, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: can't use a string pattern on a bytes-like object

(can be seen in the Travis link above) and, obviously, no report is uploaded.

In fact, I am not sure if the issue is an issue of this package, but since cpp-coveralls finishes without an error, I assume that the error is related to coveralls-python.

Do you think that you will find the time to investigate on that issue, or should I wait until the new version 1.0 is coming out?

Thanks
Manuel

debug + output complains about token

I am running with debug and output and yet coveralls complains:

coveralls debug --output=asdf
Missing .coveralls.yml file. Using only env variables.
You have to provide either repo_token in .coveralls.yml, or launch via Travis

If I set the COVERALLS_REPO_TOKEN env, the command works.

coverage.rc settings are ignored

As per the Readme I've excluded some packages in a coverage.rc file (e.g ignore migrations).

When I run regular coverage with this file it correctly excludes those packages:

coverage run --rcfile=coverage.rc setup.py test
coverage html --rcfile=coverage.rc

But when I push those changes to coveralls.io with the coveralls command, those migrations still show up in the report.

I tried things like coveralls --rcfile=coverage.rc but that does not seem to be supported.

Am I doing something wrong?

Reporting coverage on test files?

Coveralls includes test files in the coverage, even though nosetests doesn't seem to be generating coverage for them.

Coveralls job: https://coveralls.io/builds/3297384
TravisCI build: https://travis-ci.org/NVIDIA/DIGITS/builds/75482271
Here is how I invoke nosetests and coveralls: https://github.com/NVIDIA/DIGITS/blob/df401d9c52/.travis.yml#L33-L35

I'm not running nosetests with the --cover-tests option, and I can verify by looking at the TravisCI log. Coverage is not reported for the test_*.py files in the log, and the overall coverage is reported as 72%.

However, the overall coverage reported by Coveralls is 74.9%, because coverage for the test_*.py files is included. What gives? How was that coverage information even generated if not by nose?

FYI I'm requiring coveralls>=0.5, and TravisCI is installing version 0.5.

Support coverage 4.0b1

Right now coveralls does not support latest beta of coverage library.
We're willing to accept patches/pull requests addressing this issue.

How to reproduce problem on latest latest master branch:

tox -e py27-cov4,py34-cov4

Mercurial support

$ coveralls 
Submitting coverage to coveralls.io...
Traceback (most recent call last):
  File "/Users/s2092651/bin/coveralls", line 9, in <module>
    load_entry_point('coveralls==0.2', 'console_scripts', 'coveralls')()
  File "/Users/s2092651/lib/python2.7/site-packages/coveralls/cli.py", line 48, in main
    result = coverallz.wear()
  File "/Users/s2092651/lib/python2.7/site-packages/coveralls/api.py", line 72, in wear
    data = self.create_data()
  File "/Users/s2092651/lib/python2.7/site-packages/coveralls/api.py", line 112, in create_data
    self._data.update(self.git_info())
  File "/Users/s2092651/lib/python2.7/site-packages/coveralls/api.py", line 146, in git_info
    'id': gitlog('%H'),
  File "/Users/s2092651/lib/python2.7/site-packages/coveralls/api.py", line 162, in gitlog
    return str(git('--no-pager', 'log', "-1", pretty="format:%s" % format))
  File "/Users/s2092651/lib/python2.7/site-packages/sh.py", line 726, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/Users/s2092651/lib/python2.7/site-packages/sh.py", line 291, in __init__
    self.wait()
  File "/Users/s2092651/lib/python2.7/site-packages/sh.py", line 295, in wait
    self._handle_exit_code(self.process.wait())
  File "/Users/s2092651/lib/python2.7/site-packages/sh.py", line 309, in _handle_exit_code
    self.process.stderr
sh.ErrorReturnCode_128: 

  RAN: '/usr/local/bin/git --no-pager log -1 --pretty=format:%H'

  STDOUT:


  STDERR:
fatal: Not a git repository (or any of the parent directories): .git

Hits per line

I noticed that the line coverage result is binary (0 or 1) even if branch coverage is enabled. Is there any reason for not incrementing the number of hits for lines that are covered by more than one branch?

Of course this is not an exact mapping to the hits per line that Coveralls wants. But it seems better to me than a strict binary hit status (which shows less information than Ned's HTML reports).

Coveralls uses internal undocumented parts of coverage.py

I'm heavily refactoring coverage.py for version 4.0. I tried to release an alpha, but it broke coveralls, and therefore many people's tests on Travis:

Submitting coverage to coveralls.io...
Traceback (most recent call last):
  File ".tox/coveralls/bin/coveralls", line 11, in <module>
    sys.exit(main())
  File "/home/travis/build/ionelmc/python-manhole/.tox/coveralls/lib/python2.7/site-packages/coveralls/cli.py", line 49, in main
    result = coverallz.wear()
  File "/home/travis/build/ionelmc/python-manhole/.tox/coveralls/lib/python2.7/site-packages/coveralls/api.py", line 73, in wear
    data = self.create_data()
  File "/home/travis/build/ionelmc/python-manhole/.tox/coveralls/lib/python2.7/site-packages/coveralls/api.py", line 122, in create_data
    self._data = {'source_files': self.get_coverage()}
  File "/home/travis/build/ionelmc/python-manhole/.tox/coveralls/lib/python2.7/site-packages/coveralls/api.py", line 132, in get_coverage
    return reporter.report()
  File "/home/travis/build/ionelmc/python-manhole/.tox/coveralls/lib/python2.7/site-packages/coveralls/reporter.py", line 27, in report
    self.parse_file(cu, self.coverage._analyze(cu))
  File "/home/travis/build/ionelmc/python-manhole/.tox/coveralls/lib/python2.7/site-packages/coveralls/reporter.py", line 58, in parse_file
    source_file = cu.source_file()
AttributeError: 'PythonCodeUnit' object has no attribute 'source_file'

We should work together on how to fix it.

TypeError: 'dict' object is not callable

$ coveralls
Missing .coveralls.yml file. Using only env variables.
Submitting coverage to coveralls.io...
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7/bin/coveralls", line 31, in <module>
    result = coverallz.wear()
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/coveralls/api.py", line 70, in wear
    result = response.json()
TypeError: 'dict' object is not callable

Apparently requests has changed json from a function to a property. The issue probably occurs because you don't do version pinning in your requirements.txt. Please pin your versions! http://nvie.com/posts/pin-your-packages/ :)

Remove extra dependencies to speed up installation

Installation takes ~10 seconds per build

Due to all coverall-python's dependencies, installation takes around 10 seconds. Probably most of that time is spend on compiling PyYAML, only for parsing a config file most users will not be using. Also installing requests (great lib!) for doing a single post only, seems somewhat overkill. Reducing the external dependencies allows for a faster install, and speeds up all builds.

$ time pip install coveralls
Downloading/unpacking coveralls
  Downloading coveralls-0.3.zip
  Running setup.py egg_info for package coveralls
Downloading/unpacking PyYAML>=3.10 (from coveralls)
  Downloading PyYAML-3.10.tar.gz (241kB): 241kB downloaded
  Running setup.py egg_info for package PyYAML
Downloading/unpacking docopt>=0.6.1 (from coveralls)
  Downloading docopt-0.6.1.tar.gz
  Running setup.py egg_info for package docopt
Downloading/unpacking coverage>=3.6 (from coveralls)
  Downloading coverage-3.7.tar.gz (283kB): 283kB downloaded
  Running setup.py egg_info for package coverage
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
Downloading/unpacking requests>=1.0.0 (from coveralls)
  Downloading requests-2.0.1.tar.gz (412kB): 412kB downloaded
  Running setup.py egg_info for package requests
Downloading/unpacking sh>=1.08 (from coveralls)
  Downloading sh-1.09.tar.gz
  Running setup.py egg_info for package sh
Installing collected packages: coveralls, PyYAML, docopt, coverage, requests, sh
  Running setup.py install for coveralls
    Installing coveralls script to /home/travis/virtualenv/python2.6/bin
  Running setup.py install for PyYAML
    checking if libyaml is compilable
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c build/temp.linux-x86_64-2.6/check_libyaml.c -o build/temp.linux-x86_64-2.6/check_libyaml.o
    checking if libyaml is linkable
    gcc -pthread build/temp.linux-x86_64-2.6/check_libyaml.o -lyaml -o build/temp.linux-x86_64-2.6/check_libyaml
    building '_yaml' extension
    (...)
  Running setup.py install for docopt
  Running setup.py install for coverage
    building 'coverage.tracer' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c coverage/tracer.c -o build/temp.linux-x86_64-2.6/coverage/tracer.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6/coverage/tracer.o -o build/lib.linux-x86_64-2.6/coverage/tracer.so
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    Installing coverage2 script to /home/travis/virtualenv/python2.6/bin
    Installing coverage-2.6 script to /home/travis/virtualenv/python2.6/bin
    Installing coverage script to /home/travis/virtualenv/python2.6/bin
  Running setup.py install for requests
  Running setup.py install for sh
Successfully installed coveralls PyYAML docopt coverage requests sh
Cleaning up...
real    0m10.539s
user    0m8.336s
sys 0m0.781s

Using --use-mirrors, the result is only worse:

$ time pip install coveralls --use-mirrors
real    1m44.662s
user    0m10.684s
sys 0m1.183s

Fail command if no coverage found

coveralls should exit with non-zero status and output error in stderror if coveralls gathers no coverage files. This will help identify problem with empty coverage right away (like this #75).

Something like this:

$ coveralls
Error: No .coverage files found. Please make sure you've run coverage from current directory.

Cleaner error messages

I often get tracebacks from coveralls. (I assume this is due to unstable coveralls.io server, but I'm not sure.) In any case, it would probably be better to have a human-friendly message rather than leaving a stack trace. (Maybe something like Failed to connect to coveralls.io if that is in fact the problem.) Below is an extract from an existing failure example.

$ coveralls
...
Traceback (most recent call last):
...
File "/home/travis/virtualenv/python2.6/bin/coveralls", line 31, in <module>
...
ValueError: No JSON object could be decoded

Invalid version in setup.py

$ python setup.py clean
/Users/jessamyn/.virtualenvs/coveralls-python/lib/python3.4/site-packages/setuptools/dist.py:283: UserWarning: The version specified requires normalization, consider using '1.0a0' instead of '1.0a'.
self.metadata.version,
running clean

How do I use coverage/coveralls with py.test?

I can't seem to figure out how to run py.test with coverage. earlier I was doing:

  coverage run --source=myreponame setup.py test

so, I thought replacing setup.py with py.test would work, but unfortunately I think it's not that simple.

Missing data on coveralls.io

Coveralls.io doesn't show any data, although coveralls debug shows that everything is fine:

Travis: https://travis-ci.org/Cal-CS-61A-Staff/ok/jobs/71158874

Coveralls: https://coveralls.io/jobs/7122833

Am I doing something wrong? Coveralls-python has previously worked. I tried deleting and reactivating the coveralls account but to no avail.

travis.yml
.coveragerc

Update: Running locally also yields the same error, and the odd thing is that this issue (beginning 7/13) cropped up a day after the last change to travis(7/12). .coveragerc wasn't added until after the issue started -- today, as of the time of this writing. (7/15)

coveralls crashes when dealing with malformed encoding declaration

My project has source code that contains utf-8 (some of my tests are checking if my code works with weird inputs). My tests run fine and the python coverage tool also works fine, but coveralls crashes when processing it: see https://travis-ci.org/chmduquesne/ok/builds/43104434.

I am attaching the traceback:

$ coveralls
Submitting coverage to coveralls.io...
Traceback (most recent call last):
File "/usr/local/bin/coveralls", line 9, in <module>
load_entry_point('coveralls==0.4.4', 'console_scripts', 'coveralls')()
File "/usr/local/lib/python2.7/dist-packages/coveralls/cli.py", line 49, in main
result = coverallz.wear()
File "/usr/local/lib/python2.7/dist-packages/coveralls/api.py", line 73, in wear
data = self.create_data()
File "/usr/local/lib/python2.7/dist-packages/coveralls/api.py", line 122, in create_data
self._data = {'source_files': self.get_coverage()}
File "/usr/local/lib/python2.7/dist-packages/coveralls/api.py", line 132, in get_coverage
return reporter.report()
File "/usr/local/lib/python2.7/dist-packages/coveralls/reporter.py", line 27, in report
self.parse_file(cu, self.coverage._analyze(cu))
File "/usr/local/lib/python2.7/dist-packages/coveralls/reporter.py", line 64, in parse_file
source = source.decode(encoding).encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1: ordinal not in range(128)

Documentation could be clearer

The README says

First, log in via Github and add your repo on Coveralls website.

Second, install this package:

$ pip install coveralls

If you're using Travis CI, no further configuration is required.

Which raises a question: How can a package I pip install locally into my development laptop affect anything that happens between Travis CI and Coveralls.io?

Turns out some further configuration is required after all. Specifically, I have to edit .travis.yml:

  • I have to add pip install coveralls to the install section (or update my requirements.txt if I have one).
  • I have to compute the coverage (using some variation of coverage run testscript.py),
  • and then I have to push it to coveralls.io (by calling coveralls in the after_script section -- or should it be after_success? I don't know, I've seen both!).

It would be really helpful to have a sample .travis.yml in the README.

Use nose?

Under scripts in my .travis.yml, I ran coverage like this:

nosetests --with-coverage

Will that not work? How can I modify it if it won't work?

boost dependency on coverage >= 3.5 (or even 3.6)?

While troubleshooting #11 ran into

$> PYTHONPATH=/home/yoh/deb/perspect/coveralls-python ~/.local/bin/coveralls 
Submitting coverage to coveralls.io...
Traceback (most recent call last):
  File "/home/yoh/.local/bin/coveralls", line 31, in <module>
    result = coverallz.wear()
  File "/home/yoh/deb/perspect/coveralls-python/coveralls/api.py", line 67, in wear
    data = self.create_data()
  File "/home/yoh/deb/perspect/coveralls-python/coveralls/api.py", line 106, in create_data
    self._data = {'source_files': self.get_coverage()}
  File "/home/yoh/deb/perspect/coveralls-python/coveralls/api.py", line 116, in get_coverage
    return reporter.report()
  File "/home/yoh/deb/perspect/coveralls-python/coveralls/reporter.py", line 15, in report
    self.report_files(self.parse_file, morfs)
TypeError: report_files() takes at least 4 arguments (3 given)

works fine with 3.6

UnboundLocalError

We're running coveralls via CircleCI. On one of our branches today, we're seeing this error:

Testing coveralls-python...
ERROR: While preparing JSON received exception: 'ascii' codec can't decode byte 0xe2 in position 240: ordinal not in range(128)
Traceback (most recent call last):
  File "/home/ubuntu/virtualenvs/venv-2.7.8/bin/coveralls", line 9, in <module>
    load_entry_point('coveralls==0.5', 'console_scripts', 'coveralls')()
  File "/home/ubuntu/virtualenvs/venv-2.7.8/lib/python2.7/site-packages/coveralls/cli.py", line 54, in main
    coverallz.wear(dry_run=True)
  File "/home/ubuntu/virtualenvs/venv-2.7.8/lib/python2.7/site-packages/coveralls/api.py", line 78, in wear
    json_string = self.create_report()
  File "/home/ubuntu/virtualenvs/venv-2.7.8/lib/python2.7/site-packages/coveralls/api.py", line 101, in create_report
    self.debug_bad_encoding(data)
UnboundLocalError: local variable 'data' referenced before assignment

That's the output of coverall debug but we get the same error when running the regular coveralls command.

The CircleCI container is running Python 2.7.8 in a virtualenv on Ubuntu. It's running pip install coveralls, which looks like it's installing coveralls-0.5.

Presumably there are at least two bugs here:

  1. Some kind of encoding / UTF-8 issue in the data on this branch
  2. The UnboundLocalError preventing useful debugging info from being printed about number 1.

Hopefully at least that second one is a straightforward bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.