Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail on Ubuntu 14.04 LTS #3

Open
michaeljoseph opened this issue Aug 6, 2014 · 5 comments
Open

Tests fail on Ubuntu 14.04 LTS #3

michaeljoseph opened this issue Aug 6, 2014 · 5 comments

Comments

@michaeljoseph
Copy link
Contributor

$ 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
@schmittjoh
Copy link
Member

Yeah, running tests is kind of not ideal right now because coverage hard-codes the file paths for the coverage file that we use as a fixture in tests. If you want to run tests, you would need to make sure to copy the package to /home/johannes/workspace/ocular.py-dev.

To make the tests really portable, we would probably need to generate this file before running tests which would add another unknown though. Not sure if there is a better way.

@michaeljoseph
Copy link
Contributor Author

We could generate the file in a well-defined location (like ~/.coverage, or /tmp/ocular-coverage) and then move the coverage file there in the test setup?

@schmittjoh
Copy link
Member

Yeah, sounds good. Would you like to give this a try?

On Wed, Aug 6, 2014 at 2:25 PM, Michael Joseph [email protected]
wrote:

We could generate the file in a well-defined location (like ~/.coverage,
or /tmp/ocular-coverage) and then move the coverage file there in the test
setup?


Reply to this email directly or view it on GitHub
#3 (comment)
.

@michaeljoseph
Copy link
Contributor Author

Sure, what tests do you use to generate that test coverage file?

@schmittjoh
Copy link
Member

Right now, this is from the main project. It would probably make sense to embed a small test project through to add more stability when generating it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants