Comments (5)
I guess it's not too hard to make coveralls work with coverage 4.0b. However, adding newline to the end of python source file changes results a bit, compared to previous coverage version. Why is newline necessary?
from coveralls-python.
Thanks for looking into updating the support. 4.0 is not in beta yet, so the interfaces still are not finished, so it may be early to write code.
The newline is only necessary in some places (compiling to bytecode), and I could adjust how it is done, but can you tell me what kind of result changes you are seeing? I don't worry if the result numbers shift up or down a little bit.
from coveralls-python.
I'm using a custom reporter to get both coverage data and source file at the same time.
Here is a working report function, adapted to 4.0a2
def parse_file(self, cu, analysis):
""" Generate data for single file """
filename = cu.file_locator.relative_filename(cu.filename)
coverage_lines = [self.get_hits(i, analysis) for i in range(1, len(cu.parser.lines) + 1)]
source = cu.source()
self.source_files.append({
'name': filename,
'source': source,
'coverage': coverage_lines
})
As coverage.py adds an empty newline to the end of the file, I'm seeing this extra line in sources and in coverage output. It's a minor discrepancy, but still...
Example: running coverage example/runtests.py results (full pytest output)
Coverage 3.X:
hits per line: [None, None, None, 1, 1, None, None, 1, None, None, None, 1, 0]
number of source lines in project.py: 13
json-encoded source as string: u'# coding: utf-8\n\n\ndef hello():\n print(\'world\')\n\n\nclass Foo(object):\n """ Bar """\n\n\ndef baz():\n print(\'this is not tested\')'
Coverage 4.0a2:
hits per line: [None, None, None, 1, 1, None, None, 1, None, None, None, 1, 0, None]
number of source lines in project.py: 14
json-encoded source as string: u'# coding: utf-8\n\n\ndef hello():\n print(\'world\')\n\n\nclass Foo(object):\n """ Bar """\n\n\ndef baz():\n print(\'this is not tested\')\n'
I don't think that adding one extra newline changes coverage numbers much, just wanted to let you know.
from coveralls-python.
Thanks for the explanation.
from coveralls-python.
Closing this in favor of #81
from coveralls-python.
Related Issues (20)
- Coverage 6.0 moved `coverage.misc.NoSource` to `coverage.exceptions.NoSource` HOT 3
- [enhancement] Consider binding coverage version
- __init__() missing 1 required positional argument: 'name' with ``coverage ~= 6.1`` HOT 7
- Stricter Versioning For Coverage HOT 1
- Connectivity exception not handled HOT 2
- ImportError: cannot import name 'Reporter' from 'coverage.report' HOT 2
- Add python-coveralls entrypoint HOT 1
- Support for appended .coverage data files? HOT 1
- Errors running with coverage[toml] HOT 1
- ModuleNotFoundError: No module named 'setuptools.command.build' HOT 1
- Support coverage 7.0 HOT 4
- coveralls workflow fails on Python 3.5 and 3.6 with ubuntu-latest HOT 4
- Tox test on Python 3.6 fails with assertion error HOT 1
- 3.3.1: pytest is failing in units which are uning `coverage.files` module (with `coverage` 7.0.1) HOT 3
- feature request: carryforward flags HOT 1
- Parallel builds in Codebuild HOT 1
- coveralls 2.2.0 fails with KeyError: 'service_job_id' HOT 1
- 500 Server Error HOT 4
- coveralls-python maintenance status HOT 4
- Not working anymore with python-coverage version 7 or newer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coveralls-python.