question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError __init__.py not found on sqldata.py

See original GitHub issue

Describe the bug Since v5.0 was released on PyPi, we are getting the following error:

... .... ...
690 INTERNALERROR> Traceback (most recent call last):
691 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/_pytest/main.py", line 209, in wrap_session
692 INTERNALERROR>     session.exitstatus = doit(config, session) or 0
693 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/_pytest/main.py", line 249, in _main
694 INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
695 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/pluggy/hooks.py", line 284, in __call__
696 INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
697 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/pluggy/manager.py", line 67, in _hookexec
698 INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
699 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/pluggy/manager.py", line 61, in <lambda>
700 INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
701 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/pluggy/callers.py", line 203, in _multicall
702 INTERNALERROR>     gen.send(outcome)
703 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/pytest_cov/plugin.py", line 229, in pytest_runtestloop
704 INTERNALERROR>     self.cov_controller.finish()
705 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/pytest_cov/engine.py", line 167, in finish
706 INTERNALERROR>     self.cov.stop()
707 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/coverage/control.py", line 651, in combine
708 INTERNALERROR>     combine_parallel_data(self._data, aliases=aliases, data_paths=data_paths, strict=strict)
709 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/coverage/data.py", line 117, in combine_parallel_data
710 INTERNALERROR>     data.update(new_data, aliases=aliases)
711 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/coverage/sqldata.py", line 705, in update
712 INTERNALERROR>     for (file, context), numbits in lines.items()
713 INTERNALERROR>   File "/usr/local/lib/python3.6/site-packages/coverage/sqldata.py", line 705, in <listcomp>
714 INTERNALERROR>     for (file, context), numbits in lines.items()
715 INTERNALERROR> KeyError: '/builds/meltano/meltano/src/meltano/__init__.py'

To Reproduce

How can we reproduce the problem? Please be specific.

  1. What version of Python are you using?

Python 3.6

  1. What version of coverage.py are you using? The output of coverage debug sys is helpful.

Latest on PyPi --> 5.0 (coverage-5.0-cp36-cp36m-manylinux1_x86_64.whl)

  1. What versions of what packages do you have installed? The output of pip freeze is helpful.

You can check our full pip install '.[dev]' log in our runner’s log together with the pytests and the coverage run afterwards:

https://gitlab.com/meltano/meltano/-/jobs/379770331

  1. What code are you running? Give us a specific commit of a specific repo that we can check out.

https://gitlab.com/meltano/meltano/blob/master/.gitlab/ci/test.gitlab-ci.yml#L46

  1. What commands did you run?

We are running coveragepy as part of our automated tests after our pytests are done:

    - pytest -v --cov-report= --cov meltano -m "$PYTEST_MARKERS"
    - coverage combine .coverage
    - coverage report
    - coverage html

Expected behavior This was running without issues on the latest pre v5.0 stable release.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ionelmccommented, May 22, 2020

Alright, next release of pytest-cov will have a fix.

0reactions
davisaglicommented, Apr 22, 2021

For what it’s worth: I had a similar error which I tracked down to a bug in newrelic’s instrumentation of sqlite: https://github.com/newrelic/newrelic-python-agent/issues/179

Strangely, in my case the error started happening when we updated to pytest-cov 2.9.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

python logging library init.py returns keyerror and acquireLock ...
I can't be sure, but it looks as though it's because something is trying to log during program exit, when some Python objects...
Read more >
What is KeyError in Python? Dictionary and Handling Them
Here I am trying to access a key called “D” which is not present in the dictionary. Hence, the error is thrown as...
Read more >
Understanding Python imports, __init__.py and pythonpath
Learn how to import packages and modules (and the difference between the two). By the end of the tutorial, this is the directory...
Read more >
Source code for hail.table
__init__() def _set_field(self, key, value): assert key not in self. ... as well as with Python's ``gzip.open`` and R's ``read.table``.
Read more >
great_expectations Documentation - Great Expectations!
You can invoke it from the command line without using a python programming environment, but if you're working in another ecosystem, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found