Title: [BUG]: Coverage in parallel · Issue #60 · scientificcomputing/example-python-package · GitHub
Open Graph Title: [BUG]: Coverage in parallel · Issue #60 · scientificcomputing/example-python-package
X Title: [BUG]: Coverage in parallel · Issue #60 · scientificcomputing/example-python-package
Description: How to reproduce the bug mpirun -n 2 python3 -m pytest . Error output ============================= test session starts ============================== platform linux -- Python 3.10.6, pytest-7.2.0, pluggy-1.0.0 -- /usr/bin/python3 cached...
Open Graph Description: How to reproduce the bug mpirun -n 2 python3 -m pytest . Error output ============================= test session starts ============================== platform linux -- Python 3.10.6, pytest-7.2.0,...
X Description: How to reproduce the bug mpirun -n 2 python3 -m pytest . Error output ============================= test session starts ============================== platform linux -- Python 3.10.6, pytest-7.2.0,...
Opengraph URL: https://github.com/scientificcomputing/example-python-package/issues/60
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: Coverage in parallel","articleBody":"### How to reproduce the bug\n\n`mpirun -n 2 python3 -m pytest .`\r\n\n\n### Error output\n\n```bash\n============================= test session starts ==============================\r\nplatform linux -- Python 3.10.6, pytest-7.2.0, pluggy-1.0.0 -- /usr/bin/python3\r\ncachedir: .pytest_cache\r\nrootdir: /root/reproducibility, configfile: pyproject.toml, testpaths: test\r\nplugins: cov-4.0.0\r\ncollecting ... ============================= test session starts ==============================\r\nplatform linux -- Python 3.10.6, pytest-7.2.0, pluggy-1.0.0 -- /usr/bin/python3\r\ncachedir: .pytest_cache\r\nrootdir: /root/reproducibility, configfile: pyproject.toml, testpaths: test\r\nplugins: cov-4.0.0\r\ncollecting ... collected 1 item\r\n\r\ntest/test_code.py::test_addition collected 1 item\r\n\r\ntest/test_code.py::test_addition PASSED [100%]PASSED [100%]\r\nINTERNALERROR\u003e Traceback (most recent call last):\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 1106, in execute\r\nINTERNALERROR\u003e return self.con.execute(sql, parameters)\r\nINTERNALERROR\u003e sqlite3.OperationalError: no such table: coverage_schema\r\nINTERNALERROR\u003e \r\nINTERNALERROR\u003e During handling of the above exception, another exception occurred:\r\nINTERNALERROR\u003e \r\nINTERNALERROR\u003e Traceback (most recent call last):\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 1111, in execute\r\nINTERNALERROR\u003e return self.con.execute(sql, parameters)\r\nINTERNALERROR\u003e sqlite3.OperationalError: no such table: coverage_schema\r\nINTERNALERROR\u003e \r\nINTERNALERROR\u003e The above exception was the direct cause of the following exception:\r\nINTERNALERROR\u003e \r\nINTERNALERROR\u003e Traceback (most recent call last):\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 272, in _read_db\r\nINTERNALERROR\u003e schema_version, = db.execute_one(\"select version from coverage_schema\")\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 1147, in execute_one\r\nINTERNALERROR\u003e rows = list(self.execute(sql, parameters))\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 1128, in execute\r\nINTERNALERROR\u003e raise DataError(f\"Couldn't use data file {self.filename!r}: {msg}\") from exc\r\nINTERNALERROR\u003e coverage.exceptions.DataError: Couldn't use data file '/root/reproducibility/.coverage': no such table: coverage_schema\r\nINTERNALERROR\u003e \r\nINTERNALERROR\u003e During handling of the above exception, another exception occurred:\r\nINTERNALERROR\u003e \r\nINTERNALERROR\u003e Traceback (most recent call last):\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/_pytest/main.py\", line 270, in wrap_session\r\nINTERNALERROR\u003e session.exitstatus = doit(config, session) or 0\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/_pytest/main.py\", line 324, in _main\r\nINTERNALERROR\u003e config.hook.pytest_runtestloop(session=session)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/pluggy/_hooks.py\", line 265, in __call__\r\nINTERNALERROR\u003e return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/pluggy/_manager.py\", line 80, in _hookexec\r\nINTERNALERROR\u003e return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/pluggy/_callers.py\", line 55, in _multicall\r\nINTERNALERROR\u003e gen.send(outcome)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/pytest_cov/plugin.py\", line 297, in pytest_runtestloop\r\nINTERNALERROR\u003e self.cov_controller.finish()\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/pytest_cov/engine.py\", line 44, in ensure_topdir_wrapper\r\nINTERNALERROR\u003e return meth(self, *args, **kwargs)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/pytest_cov/engine.py\", line 247, in finish\r\nINTERNALERROR\u003e self.cov.combine()\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/control.py\", line 755, in combine\r\nINTERNALERROR\u003e combine_parallel_data(\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/data.py\", line 132, in combine_parallel_data\r\nINTERNALERROR\u003e data.update(new_data, aliases=aliases)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 657, in update\r\nINTERNALERROR\u003e with self._connect() as con:\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 315, in _connect\r\nINTERNALERROR\u003e self._open_db()\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 266, in _open_db\r\nINTERNALERROR\u003e self._read_db()\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 275, in _read_db\r\nINTERNALERROR\u003e self._init_db(db)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 301, in _init_db\r\nINTERNALERROR\u003e db.executescript(SCHEMA)\r\nINTERNALERROR\u003e File \"/usr/local/lib/python3.10/dist-packages/coverage/sqldata.py\", line 1178, in executescript\r\nINTERNALERROR\u003e self.con.executescript(script)\r\nINTERNALERROR\u003e sqlite3.OperationalError: table coverage_schema already exists\r\n\r\n============================== 1 passed in 0.01s ===============================\r\n\r\n\r\n---------- coverage: platform linux, python 3.10.6-final-0 -----------\r\nName Stmts Miss Cover Missing\r\n----------------------------------------------------------------------------------------------\r\n/usr/local/lib/python3.10/dist-packages/mypackage/__init__.py 5 0 100%\r\n/usr/local/lib/python3.10/dist-packages/mypackage/functions.py 7 3 57% 16-18\r\n----------------------------------------------------------------------------------------------\r\nTOTAL 12 3 75%\r\nCoverage HTML written to dir htmlcov\r\n\r\n\r\n============================== 1 passed in 0.02s ===============================\n```\n\n\n### Version\n\nmain branch\n\n### system\n\n```docker \r\nFROM ubuntu:22.04\r\n\r\nWORKDIR /root/\r\n\r\n\r\nRUN apt-get update \u0026\u0026 \\\r\n apt-get install -y git mpich python3-pip \u0026\u0026 \\\r\n python3 -m pip install --upgrade pip setuptools \u0026\u0026 \\\r\n apt-get purge -y python3-setuptools\r\n\r\nRUN git clone https://github.com/scientificcomputing/reproducibility\r\n\r\n\r\nRUN python3 -m pip install ./reproducibility[test]\r\n```\n\n### Additional information\n\nFixed with adding `--cov-append` to \r\n```toml\r\n[tool.pytest.ini_options]\r\naddopts\r\n```","author":{"url":"https://github.com/jorgensd","@type":"Person","name":"jorgensd"},"datePublished":"2022-10-27T15:15:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/60/example-python-package/issues/60"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bc038328-308b-d9ca-15d7-55ec647f8a52 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5E2:11B23B:4471C:6452D:6A4DF8D1 |
| html-safe-nonce | 6c0a5add98ac0a5ecc4ba5e6321cc80626907c045cdf168b020a63d2efe68d23 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUUyOjExQjIzQjo0NDcxQzo2NDUyRDo2QTRERjhEMSIsInZpc2l0b3JfaWQiOiIyOTY1Njk2MjE0MTE5MzQ4NDMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 86584900d5979970bd9ccfb71ce76775a5da2c5160bcda5ddd61bbd7b7d2cfd8 |
| hovercard-subject-tag | issue:1425815837 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/scientificcomputing/example-python-package/60/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9e484c0266c94ec0bc8aaee4ac06b79be689658dd65da264faadfa1e2e39901a/scientificcomputing/example-python-package/issues/60 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9e484c0266c94ec0bc8aaee4ac06b79be689658dd65da264faadfa1e2e39901a/scientificcomputing/example-python-package/issues/60 |
| og:image:alt | How to reproduce the bug mpirun -n 2 python3 -m pytest . Error output ============================= test session starts ============================== platform linux -- Python 3.10.6, pytest-7.2.0,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jorgensd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5818716c93c6a2925b815402541a32814e43a7b1261c322b0c2df75224289566 |
| turbo-cache-control | no-preview |
| go-import | github.com/scientificcomputing/example-python-package git https://github.com/scientificcomputing/example-python-package.git |
| octolytics-dimension-user_id | 56604411 |
| octolytics-dimension-user_login | scientificcomputing |
| octolytics-dimension-repository_id | 535572604 |
| octolytics-dimension-repository_nwo | scientificcomputing/example-python-package |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 535572604 |
| octolytics-dimension-repository_network_root_nwo | scientificcomputing/example-python-package |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4314b1df11fa8a565684f3a72dc971e3785da365 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width