scrutinizer-ci / ocular.py Goto Github PK
View Code? Open in Web Editor NEWUploads Python code coverage to scrutinizer-ci.com
License: MIT License
Uploads Python code coverage to scrutinizer-ci.com
License: MIT License
I'm trying to call ocular
as part of my Travis-CI build, but am getting a traceback:
$ ocular
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.3.5/bin/ocular", line 9, in <module>
load_entry_point('scrutinizer-ocular==1.0.0', 'console_scripts', 'ocular')()
File "/home/travis/virtualenv/python3.3.5/lib/python3.3/site-packages/scrutinizer/ocular/app.py", line 11, in main
App().run()
File "/home/travis/virtualenv/python3.3.5/lib/python3.3/site-packages/scrutinizer/ocular/app.py", line 22, in run
repository_name = self.parse_repository_name(args.repository)
File "/home/travis/virtualenv/python3.3.5/lib/python3.3/site-packages/scrutinizer/ocular/app.py", line 61, in parse_repository_name
return self.introspector.get_repository_name()
File "/home/travis/virtualenv/python3.3.5/lib/python3.3/site-packages/scrutinizer/ocular/repository_introspector.py", line 23, in get_repository_name
output = check_output(['git', 'remote', '-v'], cwd=self.dir).decode('ascii')
File "/opt/python/3.3.5/lib/python3.3/subprocess.py", line 576, in check_output
with Popen(*popenargs, stdout=PIPE, **kwargs) as process:
File "/opt/python/3.3.5/lib/python3.3/subprocess.py", line 819, in __init__
restore_signals, start_new_session)
File "/opt/python/3.3.5/lib/python3.3/subprocess.py", line 1386, in _execute_child
restore_signals, start_new_session, preexec_fn)
TypeError: Can't convert 'builtin_function_or_method' object to str implicitly
Is something configured incorrectly?
Traceback (most recent call last):
File "/home/michael/.virtualenvs/changes/bin/ocular", line 9, in <module>
load_entry_point('scrutinizer-ocular==1.0.1', 'console_scripts', 'ocular')()
File "/home/michael/.virtualenvs/changes/local/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/michael/.virtualenvs/changes/local/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
return ep.load()
File "/home/michael/.virtualenvs/changes/local/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
ImportError: No module named scrutinizer.ocular.app
$ python setup.py develop
$ python setup.py test
running test
running egg_info
writing dependency_links to scrutinizer_ocular.egg-info/dependency_links.txt
writing requirements to scrutinizer_ocular.egg-info/requires.txt
writing scrutinizer_ocular.egg-info/PKG-INFO
writing top-level names to scrutinizer_ocular.egg-info/top_level.txt
writing entry points to scrutinizer_ocular.egg-info/entry_points.txt
reading manifest file 'scrutinizer_ocular.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'scrutinizer_ocular.egg-info/SOURCES.txt'
running build_ext
========================================================================== test session starts ===========================================================================
platform linux2 -- Python 2.7.6 -- py-1.4.23 -- pytest-2.6.0
collected 7 items
tests/test_coverage_parser.py F
tests/test_integration.py F
tests/test_repository_introspector.py sss
tests/test_uploader.py ..
================================================================================ FAILURES ================================================================================
_________________________________________________________________ CoverageParserTest.test_parse_coverage _________________________________________________________________
self = <tests.test_coverage_parser.CoverageParserTest testMethod=test_parse_coverage>
def test_parse_coverage(self):
> xml_data = self.parser.parse('tests/res/sample-coverage', None)
tests/test_coverage_parser.py:12:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scrutinizer/ocular/coverage_parser.py:14: in parse
coverage_data.xml_report(outfile=xml_report_file.name)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/control.py:694: in xml_report
return reporter.report(morfs, outfile=outfile)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/xmlreport.py:56: in report
self.report_files(self.xml_file, morfs)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/report.py:84: in report_files
report_fn(cu, self.coverage._analyze(cu))
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/control.py:592: in _analyze
return Analysis(self, it)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/results.py:18: in __init__
actual_filename, source = self.find_source(self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.results.Analysis object at 0x7f27b7de9d10>, filename = '/home/johannes/workspace/ocular.py-dev/scrutinizer/__init__.py'
def find_source(self, filename):
"""Find the source for `filename`.
Returns two values: the actual filename, and the source.
The source returned depends on which of these cases holds:
* The filename seems to be a non-source file: returns None
* The filename is a source file, and actually exists: returns None.
* The filename is a source file, and is in a zip file or egg:
returns the source.
* The filename is a source file, but couldn't be found: raises
`NoSource`.
"""
source = None
base, ext = os.path.splitext(filename)
TRY_EXTS = {
'.py': ['.py', '.pyw'],
'.pyw': ['.pyw'],
}
try_exts = TRY_EXTS.get(ext)
if not try_exts:
return filename, None
for try_ext in try_exts:
try_filename = base + try_ext
if os.path.exists(try_filename):
return try_filename, None
source = self.coverage.file_locator.get_zip_data(try_filename)
if source:
return try_filename, source
> raise NoSource("No source for code: '%s'" % filename)
E NoSource: No source for code: '/home/johannes/workspace/ocular.py-dev/scrutinizer/__init__.py'
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/results.py:92: NoSource
_________________________________________________________________ IntegrationTest.test_uploads_coverage __________________________________________________________________
self = <tests.test_integration.IntegrationTest testMethod=test_uploads_coverage>
def test_uploads_coverage(self):
parser = CoverageParser()
> xml_data = parser.parse('tests/res/sample-coverage', None)
tests/test_integration.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
scrutinizer/ocular/coverage_parser.py:14: in parse
coverage_data.xml_report(outfile=xml_report_file.name)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/control.py:694: in xml_report
return reporter.report(morfs, outfile=outfile)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/xmlreport.py:56: in report
self.report_files(self.xml_file, morfs)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/report.py:84: in report_files
report_fn(cu, self.coverage._analyze(cu))
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/control.py:592: in _analyze
return Analysis(self, it)
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/results.py:18: in __init__
actual_filename, source = self.find_source(self.filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <coverage.results.Analysis object at 0x7f27b7dfbd90>, filename = '/home/johannes/workspace/ocular.py-dev/scrutinizer/__init__.py'
def find_source(self, filename):
"""Find the source for `filename`.
Returns two values: the actual filename, and the source.
The source returned depends on which of these cases holds:
* The filename seems to be a non-source file: returns None
* The filename is a source file, and actually exists: returns None.
* The filename is a source file, and is in a zip file or egg:
returns the source.
* The filename is a source file, but couldn't be found: raises
`NoSource`.
"""
source = None
base, ext = os.path.splitext(filename)
TRY_EXTS = {
'.py': ['.py', '.pyw'],
'.pyw': ['.pyw'],
}
try_exts = TRY_EXTS.get(ext)
if not try_exts:
return filename, None
for try_ext in try_exts:
try_filename = base + try_ext
if os.path.exists(try_filename):
return try_filename, None
source = self.coverage.file_locator.get_zip_data(try_filename)
if source:
return try_filename, source
> raise NoSource("No source for code: '%s'" % filename)
E NoSource: No source for code: '/home/johannes/workspace/ocular.py-dev/scrutinizer/__init__.py'
../../.virtualenvs/ocular.py/local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg/coverage/results.py:92: NoSource
============================================================= 2 failed, 2 passed, 3 skipped in 7.05 seconds ==============================================================
Exception OSError: (2, 'No such file or directory', '/tmp/tmpX4h2ag') in <bound method _TemporaryFileWrapper.__del__ of <closed file '<fdopen>', mode 'w+b' at 0x7f27b87f7540>> ignored
Exception OSError: (2, 'No such file or directory', '/tmp/tmp6jUENT') in <bound method _TemporaryFileWrapper.__del__ of <closed file '<fdopen>', mode 'w+b' at 0x7f27b7e07390>> ignored
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.