Skip to content

Commit

Permalink
test(frontend): run only in multi instead of changing config
Browse files Browse the repository at this point in the history
as test runs two times, once in mono, and once in multi, we can just
skip the test unless we are in multi
  • Loading branch information
youben11 committed Aug 22, 2024
1 parent 613ecbe commit 29811c9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions frontends/concrete-python/tests/execution/test_tfhers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ def test_tfhers_conversion_binary_encrypted(
"""

parameter_encryption_statuses = helpers.generate_encryption_statuses(parameters)
# tfhers int works with multi-parameters only
configuration = helpers.configuration().fork(
parameter_selection_strategy=fhe.ParameterSelectionStrategy.MULTI
)

# Only valid when running in multi
if helpers.configuration().parameter_selection_strategy != fhe.ParameterSelectionStrategy.MULTI:
return

dtype = parameterize_partial_dtype(dtype)

Expand All @@ -128,7 +128,7 @@ def test_tfhers_conversion_binary_encrypted(
tuple(tfhers.TFHERSInteger(dtype, arg) for arg in inpt)
for inpt in helpers.generate_inputset(parameters)
]
circuit = compiler.compile(inputset, configuration)
circuit = compiler.compile(inputset, helpers.configuration())

assert is_input_and_output_tfhers(
circuit,
Expand Down Expand Up @@ -231,10 +231,10 @@ def test_tfhers_conversion_one_encrypted_one_native(
"""

parameter_encryption_statuses = helpers.generate_encryption_statuses(parameters)
# tfhers int works with multi-parameters only
configuration = helpers.configuration().fork(
parameter_selection_strategy=fhe.ParameterSelectionStrategy.MULTI
)

# Only valid when running in multi
if helpers.configuration().parameter_selection_strategy != fhe.ParameterSelectionStrategy.MULTI:
return

dtype = parameterize_partial_dtype(dtype)

Expand All @@ -247,7 +247,7 @@ def test_tfhers_conversion_one_encrypted_one_native(
(tfhers.TFHERSInteger(dtype, inpt[0]), inpt[1])
for inpt in helpers.generate_inputset(parameters)
]
circuit = compiler.compile(inputset, configuration)
circuit = compiler.compile(inputset, helpers.configuration())

assert is_input_and_output_tfhers(
circuit,
Expand Down Expand Up @@ -519,8 +519,10 @@ def test_tfhers_conversion_without_multi(function, parameters, parameter_strateg
"""

parameter_encryption_statuses = helpers.generate_encryption_statuses(parameters)
# tfhers int works with multi-parameters only
configuration = helpers.configuration().fork(parameter_selection_strategy=parameter_strategy)

# Only valid when running in multi
if helpers.configuration().parameter_selection_strategy != fhe.ParameterSelectionStrategy.MULTI:
return

dtype = parameterize_partial_dtype(tfhers.uint16_2_2)

Expand All @@ -534,7 +536,7 @@ def test_tfhers_conversion_without_multi(function, parameters, parameter_strateg
for inpt in helpers.generate_inputset(parameters)
]
with pytest.raises(RuntimeError, match=f"Can't use tfhers integers with {parameter_strategy}"):
compiler.compile(inputset, configuration)
compiler.compile(inputset, helpers.configuration())


def test_tfhers_circuit_eval():
Expand Down

0 comments on commit 29811c9

Please sign in to comment.