File: conftest.py

package info (click to toggle)
python-eth-hash 0.7.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 308 kB
  • sloc: python: 659; makefile: 233
file content (25 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest


@pytest.fixture(params=["auto", "explicit", "env"])
def keccak(monkeypatch, request, keccak_auto):
    if request.param == "auto":
        return keccak_auto
    elif request.param == "explicit":
        from eth_hash import (
            Keccak256,
        )
        from eth_hash.backends import (
            pysha3,
        )

        return Keccak256(pysha3)
    elif request.param == "env":
        monkeypatch.setenv("ETH_HASH_BACKEND", "pysha3")
        from eth_hash.auto import (
            keccak,
        )

        return keccak
    else:
        raise AssertionError(f"Unrecognized approach to import keccak: {request.param}")