Debugging errors in test files

%%file test3.py
“”"
Tests of execution of bitwise operations.
“”"

import random

import numpy as np
import pytest

from concrete import fhe
from concrete.fhe.dtypes import Integer
from concrete.fhe.values import ValueDescription

cases = []
for lhs_bit_width in range(1, 6):
for rhs_bit_width in range(1, 6):
cases += [
[
# operation
operation,
# bit widths
lhs_bit_width,
rhs_bit_width,
# shapes
(),
(),
# strategy
None,
]
for operation in [
(“|”, lambda x, y: x | y),
]
]

for _ in range(10):
cases.append(
[
# operation
random.choice(
[
(“&”, lambda x, y: x & y),
(“|”, lambda x, y: x | y),
(“^”, lambda x, y: x ^ y),
]
),
# bit widths
random.choice([1, 2, 3, 4, 5]),
random.choice([1, 2, 3, 4, 5]),
# shapes
random.choice([(), (2,), (3, 2)]),
random.choice([(), (2,), (3, 2)]),
# strategy
random.choice(
[
fhe.BitwiseStrategy.ONE_TLU_PROMOTED,
fhe.BitwiseStrategy.THREE_TLU_CASTED,
fhe.BitwiseStrategy.TWO_TLU_BIGGER_PROMOTED_SMALLER_CASTED,
fhe.BitwiseStrategy.TWO_TLU_BIGGER_CASTED_SMALLER_PROMOTED,
]
),
]
)

pylint: disable=redefined-outer-name

@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
operation,
lhs_bit_width,
rhs_bit_width,
lhs_shape,
rhs_shape,
strategy,
helpers,
):
“”"
Test bitwise operations between encrypted integers.
“”"

name, function = operation

lhs_dtype = Integer(is_signed=False, bit_width=lhs_bit_width)
rhs_dtype = Integer(is_signed=False, bit_width=rhs_bit_width)

lhs_description = ValueDescription(lhs_dtype, shape=lhs_shape, is_encrypted=True)
rhs_description = ValueDescription(rhs_dtype, shape=rhs_shape, is_encrypted=True)

print()
print()
print(
    f"[{lhs_description}] ({name}) [{rhs_description}]"
    + (f" {{{strategy}}}" if strategy is not None else "")
)
print()
print()

parameter_encryption_statuses = {"x": "encrypted", "y": "encrypted"}
configuration = helpers.configuration().fork(use_insecure_key_cache=False)

if strategy is not None:
    configuration = configuration.fork(bitwise_strategy_preference=[strategy])

compiler = fhe.Compiler(function, parameter_encryption_statuses)

inputset = [
    (
        np.random.randint(lhs_dtype.min(), lhs_dtype.max() + 1, size=lhs_shape),
        np.random.randint(rhs_dtype.min(), rhs_dtype.max() + 1, size=rhs_shape),
    )
    for _ in range(100)
]
circuit = compiler.compile(inputset, configuration)

samples = [
    [
        np.zeros(lhs_shape, dtype=np.int64),
        np.zeros(rhs_shape, dtype=np.int64),
    ],
    [
        np.ones(lhs_shape, dtype=np.int64) * lhs_dtype.min(),
        np.ones(rhs_shape, dtype=np.int64) * rhs_dtype.min(),
    ],
    [
        np.ones(lhs_shape, dtype=np.int64) * lhs_dtype.max(),
        np.ones(rhs_shape, dtype=np.int64) * rhs_dtype.min(),
    ],
    [
        np.ones(lhs_shape, dtype=np.int64) * lhs_dtype.max(),
        np.ones(rhs_shape, dtype=np.int64) * rhs_dtype.max(),
    ],
    [
        np.random.randint(lhs_dtype.min(), lhs_dtype.max() + 1, size=lhs_shape),
        np.random.randint(rhs_dtype.min(), rhs_dtype.max() + 1, size=rhs_shape),
    ],
]
for sample in samples:
    helpers.check_execution(circuit, function, sample, retries=5)

!pytest test3.py

E AttributeError: module ‘concrete.fhe’ has no attribute ‘BitwiseStrategy’
=========================== short test summary info ============================
ERROR test3.py - AttributeError: module ‘concrete.fhe’ has no attribute ‘BitwiseStrategy’
!!! Interrupted: 1 error during collection !!!
=============================== 1 error in 1.01s ===============================

BitwiseStrategy is recently introduced. Have you tried with v2.4.0 :slightly_smiling_face:

is there a new release update ? I think its v2.3.0(right)

v2.4.0 is released yesterday :slightly_smiling_face:

I updated the version ,Here is result of execution

============================= test session starts ==============================
platform linux – Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/user/Desktop
plugins: anyio-3.5.0
collected 35 items

test3.py EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE [100%]

==================================== ERRORS ====================================
__ ERROR at setup of test_bitwise[operation0-1-1-lhs_shape0-rhs_shape0-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation1-1-2-lhs_shape1-rhs_shape1-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation2-1-3-lhs_shape2-rhs_shape2-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation3-1-4-lhs_shape3-rhs_shape3-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation4-1-5-lhs_shape4-rhs_shape4-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation5-2-1-lhs_shape5-rhs_shape5-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation6-2-2-lhs_shape6-rhs_shape6-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation7-2-3-lhs_shape7-rhs_shape7-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation8-2-4-lhs_shape8-rhs_shape8-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
__ ERROR at setup of test_bitwise[operation9-2-5-lhs_shape9-rhs_shape9-None] ___
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation10-3-1-lhs_shape10-rhs_shape10-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation11-3-2-lhs_shape11-rhs_shape11-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation12-3-3-lhs_shape12-rhs_shape12-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation13-3-4-lhs_shape13-rhs_shape13-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation14-3-5-lhs_shape14-rhs_shape14-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation15-4-1-lhs_shape15-rhs_shape15-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation16-4-2-lhs_shape16-rhs_shape16-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation17-4-3-lhs_shape17-rhs_shape17-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation18-4-4-lhs_shape18-rhs_shape18-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation19-4-5-lhs_shape19-rhs_shape19-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation20-5-1-lhs_shape20-rhs_shape20-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation21-5-2-lhs_shape21-rhs_shape21-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation22-5-3-lhs_shape22-rhs_shape22-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation23-5-4-lhs_shape23-rhs_shape23-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation24-5-5-lhs_shape24-rhs_shape24-None] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation25-4-3-lhs_shape25-rhs_shape25-two-tlu-bigger-promoted-smaller-casted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation26-4-2-lhs_shape26-rhs_shape26-one-tlu-promoted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation27-2-2-lhs_shape27-rhs_shape27-two-tlu-bigger-promoted-smaller-casted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation28-1-4-lhs_shape28-rhs_shape28-three-tlu-casted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation29-5-4-lhs_shape29-rhs_shape29-three-tlu-casted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation30-2-2-lhs_shape30-rhs_shape30-three-tlu-casted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation31-2-1-lhs_shape31-rhs_shape31-one-tlu-promoted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation32-2-4-lhs_shape32-rhs_shape32-two-tlu-bigger-casted-smaller-promoted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation33-4-3-lhs_shape33-rhs_shape33-two-tlu-bigger-casted-smaller-promoted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
_ ERROR at setup of test_bitwise[operation34-4-4-lhs_shape34-rhs_shape34-three-tlu-casted] _
file /home/user/Desktop/test3.py, line 67
@pytest.mark.parametrize(
“operation,lhs_bit_width,rhs_bit_width,lhs_shape,rhs_shape,strategy”,
cases,
)
def test_bitwise(
E fixture ‘helpers’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/user/Desktop/test3.py:67
=========================== short test summary info ============================
ERROR test3.py::test_bitwise[operation0-1-1-lhs_shape0-rhs_shape0-None]
ERROR test3.py::test_bitwise[operation1-1-2-lhs_shape1-rhs_shape1-None]
ERROR test3.py::test_bitwise[operation2-1-3-lhs_shape2-rhs_shape2-None]
ERROR test3.py::test_bitwise[operation3-1-4-lhs_shape3-rhs_shape3-None]
ERROR test3.py::test_bitwise[operation4-1-5-lhs_shape4-rhs_shape4-None]
ERROR test3.py::test_bitwise[operation5-2-1-lhs_shape5-rhs_shape5-None]
ERROR test3.py::test_bitwise[operation6-2-2-lhs_shape6-rhs_shape6-None]
ERROR test3.py::test_bitwise[operation7-2-3-lhs_shape7-rhs_shape7-None]
ERROR test3.py::test_bitwise[operation8-2-4-lhs_shape8-rhs_shape8-None]
ERROR test3.py::test_bitwise[operation9-2-5-lhs_shape9-rhs_shape9-None]
ERROR test3.py::test_bitwise[operation10-3-1-lhs_shape10-rhs_shape10-None]
ERROR test3.py::test_bitwise[operation11-3-2-lhs_shape11-rhs_shape11-None]
ERROR test3.py::test_bitwise[operation12-3-3-lhs_shape12-rhs_shape12-None]
ERROR test3.py::test_bitwise[operation13-3-4-lhs_shape13-rhs_shape13-None]
ERROR test3.py::test_bitwise[operation14-3-5-lhs_shape14-rhs_shape14-None]
ERROR test3.py::test_bitwise[operation15-4-1-lhs_shape15-rhs_shape15-None]
ERROR test3.py::test_bitwise[operation16-4-2-lhs_shape16-rhs_shape16-None]
ERROR test3.py::test_bitwise[operation17-4-3-lhs_shape17-rhs_shape17-None]
ERROR test3.py::test_bitwise[operation18-4-4-lhs_shape18-rhs_shape18-None]
ERROR test3.py::test_bitwise[operation19-4-5-lhs_shape19-rhs_shape19-None]
ERROR test3.py::test_bitwise[operation20-5-1-lhs_shape20-rhs_shape20-None]
ERROR test3.py::test_bitwise[operation21-5-2-lhs_shape21-rhs_shape21-None]
ERROR test3.py::test_bitwise[operation22-5-3-lhs_shape22-rhs_shape22-None]
ERROR test3.py::test_bitwise[operation23-5-4-lhs_shape23-rhs_shape23-None]
ERROR test3.py::test_bitwise[operation24-5-5-lhs_shape24-rhs_shape24-None]
ERROR test3.py::test_bitwise[operation25-4-3-lhs_shape25-rhs_shape25-two-tlu-bigger-promoted-smaller-casted]
ERROR test3.py::test_bitwise[operation26-4-2-lhs_shape26-rhs_shape26-one-tlu-promoted]
ERROR test3.py::test_bitwise[operation27-2-2-lhs_shape27-rhs_shape27-two-tlu-bigger-promoted-smaller-casted]
ERROR test3.py::test_bitwise[operation28-1-4-lhs_shape28-rhs_shape28-three-tlu-casted]
ERROR test3.py::test_bitwise[operation29-5-4-lhs_shape29-rhs_shape29-three-tlu-casted]
ERROR test3.py::test_bitwise[operation30-2-2-lhs_shape30-rhs_shape30-three-tlu-casted]
ERROR test3.py::test_bitwise[operation31-2-1-lhs_shape31-rhs_shape31-one-tlu-promoted]
ERROR test3.py::test_bitwise[operation32-2-4-lhs_shape32-rhs_shape32-two-tlu-bigger-casted-smaller-promoted]
ERROR test3.py::test_bitwise[operation33-4-3-lhs_shape33-rhs_shape33-two-tlu-bigger-casted-smaller-promoted]
ERROR test3.py::test_bitwise[operation34-4-4-lhs_shape34-rhs_shape34-three-tlu-casted]
============================== 35 errors in 0.92s ==============================

How are you lunching the tests? You need to have the conftest.py to have the helpers.

Sorry @umutsahin for the late reply , actually I was writing each cell in jupyter as a python file and then tried executing command pytest filename.py
but probably before running i need to understand what is this helpers.config(),what is this conftest
Do i need to include them seperately as an import?

Also while executing some compile test files
I tried executing this
server_lambda = support.load_server_lambda(compilation_result)
I got <concrete.compiler.library_compilation_result.LibraryCompilationResult object at 0x7f4128af0910>
No way to see even the server_lambda ?

Hi @Laser_beam,

what is this conftest

It’s a way to define global fixtures in pytest. See:

https://docs.pytest.org/en/6.2.x/fixture.html#conftest-py-sharing-fixtures-across-multiple-files

Do i need to include them seperately as an import?

It’s automatically included by pytest if the file exist.

No way to see even the server_lambda ?

You can read the source code here:

but it’s not possible to inspect it from Python :slightly_smiling_face:

Hope this helps!

def test_keys_save_load(helpers):
“”"
Test saving and loading keys.
“”"

@fhe.compiler({"x": "encrypted"})
def f(x):
    return x**2

inputset = range(10)

with tempfile.TemporaryDirectory() as tmp_dir:
    tmp_dir_path = Path(tmp_dir)
    keys_path = tmp_dir_path / "keys"

    circuit1 = f.compile(inputset, helpers.configuration().fork(use_insecure_key_cache=False))
    circuit1.keygen()

    sample = circuit1.encrypt(5)
    evaluation = circuit1.run(sample)

    circuit1.keys.save(str(keys_path))
    circuit2 = f.compile(inputset, helpers.configuration().fork(use_insecure_key_cache=False))
    circuit2.keys.load(str(keys_path))

    assert circuit2.decrypt(evaluation) == 25

How do i provide the helpers argument explicitly

Helpers are defined here https://github.com/zama-ai/concrete/blob/76b72b7feb0670fcd7f3b1c80e5aba68b072a875/frontends/concrete-python/tests/conftest.py#L124, you can copy paste this code and pass Helpers class as the argument if you want. But some tests require other fixtures, I’d just copy the whole conftest file in my directory :slightly_smiling_face:

Ya I tried that but I am getting one more issue:
E fixture ‘keyset_cache’ not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, helpers, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

Which test requires keyset_cache fixture? Could you share it’s code :slightly_smiling_face:

This test belong to an entirely different test suite. It’s one of the compiler binding tests and they have a different conftest (https://github.com/zama-ai/concrete/blob/main/compilers/concrete-compiler/compiler/tests/python/conftest.py).

I’m curious as to why you’re running the test suite like this :slightly_smiling_face:

Just an error from my side I didnt check the conftest file properly,But thanks for pointing out

Let me clear myself about this
how do i run the test below( do i need to install gtest( any specific version)and how do i include the other files

So, now it’s good, right?

Ya ok now except one

but this test file is having issue
RuntimeError
----------------------------- Captured stderr call -----------------------------
loc(“-”:5:22): error: failed to legalize operation ‘TFHE.encode_lut_for_crt_woppbs’ that was explicitly marked illegal
=========================== short test summary info ============================
FAILED test_simulation.py::test_lib_compile_and_run_simulation[add_lut_crt] - RuntimeError: Can’t compile: Simulating TFHE failed

Hi, wopPBS simulation support just got released recently! Could you try with v2.5.0-rc1 :slightly_smiling_face:

(keep in mind that the support is still experimental, it’ll compile now but the execution simulation might not be as accurate as it can be, hence the rc)

Sorry I didnt understand what is v2.5.0-rc1,
what is rc1?

It’s a release candidate that we recently had. See concrete-python · PyPI :slightly_smiling_face: