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

ImportError when running tests with --cov #3304

Open
adiasg opened this issue Mar 22, 2023 · 2 comments
Open

ImportError when running tests with --cov #3304

adiasg opened this issue Mar 22, 2023 · 2 comments
Labels
general:bug Something isn't working

Comments

@adiasg
Copy link
Contributor

adiasg commented Mar 22, 2023

Encountering an error when running tests. I'm using consensus-specs @ 0b76c83.

Setup

make clean; make pyspec; make install_test; . venv/bin/activate; cd tests/core/pyspec/
$ python3 --version
Python 3.8.10
$ pip install py_arkworks_bls12381==0.3.4
Requirement already satisfied: py_arkworks_bls12381==0.3.4 in /home/ubuntu/specs/consensus-specs/venv/lib/python3.8/site-packages (0.3.4)

Error

$ python3 -m pytest --cov=eth2spec.phase0.minimal eth2spec
ImportError while loading conftest '/home/ubuntu/specs/consensus-specs/tests/core/pyspec/eth2spec/test/conftest.py'.
eth2spec/test/conftest.py:1: in <module>
    from eth2spec.test import context
eth2spec/test/context.py:6: in <module>
    from eth2spec.phase0 import mainnet as spec_phase0_mainnet, minimal as spec_phase0_minimal
eth2spec/phase0/__init__.py:1: in <module>
    from . import mainnet as spec  # noqa:F401
eth2spec/phase0/mainnet.py:15: in <module>
    from eth2spec.utils import bls
eth2spec/utils/bls.py:21: in <module>
    from py_arkworks_bls12381 import (
../../../venv/lib/python3.8/site-packages/py_arkworks_bls12381/__init__.py:1: in <module>
    from .py_arkworks_bls12381 import *
E   ImportError: PyO3 modules may only be initialized once per interpreter process
  • This error appears when running running tests with any --cov flag.
  • The other flags (-n, --disable-bls, --cov-report, and --cov-branch) do not cause this error - able to test successfully with these.

What I've tried so far:

  • (Thanks @hwwhww!) Uninstall py_arkworks_bls12381 & build from source instead: $ pip install --no-binary py_arkworks_bls12381 py_arkworks_bls12381. This did not help with the error.
@adiasg adiasg added the general:bug Something isn't working label Mar 22, 2023
@saltiniroberto
Copy link
Contributor

saltiniroberto commented Apr 20, 2023

The following command allows running the tests without --cov

make COVERAGE_SCOPE="" test

@michaelneuder
Copy link

^ worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@michaelneuder @adiasg @saltiniroberto and others