Skip to content

Latest commit

Β 

History

History
48 lines (39 loc) Β· 1.62 KB

File metadata and controls

48 lines (39 loc) Β· 1.62 KB

Testing

Running Tests

./quicktest.sh -m "not fuzzing"          # standard test run (-nauto by default via setup.cfg)
./quicktest.sh tests/unit/               # unit tests only
./quicktest.sh tests/functional/         # functional tests only
./quicktest.sh tests/unit/compiler/venom/ # venom unit tests
./quicktest.sh --hevm -m hevm            # hevm-based tests (needs hevm in PATH)

quicktest.sh wraps pytest with -q -s --instafail -x (bail on first failure).

Test Organization

tests/
β”œβ”€β”€ unit/           # isolated component tests
β”‚   β”œβ”€β”€ ast/
β”‚   β”œβ”€β”€ semantics/
β”‚   β”œβ”€β”€ compiler/
β”‚   β”‚   └── venom/  # venom pass & analysis tests
β”‚   β”œβ”€β”€ cli/
β”‚   └── ...
β”œβ”€β”€ functional/     # end-to-end compilation & execution
β”‚   β”œβ”€β”€ builtins/
β”‚   β”œβ”€β”€ codegen/
β”‚   β”œβ”€β”€ grammar/
β”‚   β”œβ”€β”€ syntax/
β”‚   └── venom/
β”œβ”€β”€ conftest.py     # shared fixtures
β”œβ”€β”€ evm_backends/   # EVM execution backends for tests
└── venom_utils.py  # helpers for venom tests

Key Fixtures & Helpers

  • tests/conftest.py β€” main fixtures (compiler invocation, EVM backends)
  • tests/evm_backends/ β€” pluggable EVM execution (pyevm, pyrevm)
  • tests/venom_utils.py β€” helpers for constructing Venom IR in tests

Writing Tests

  • Functional tests typically compile a Vyper snippet and execute it against an EVM backend
  • Venom unit tests construct IR programmatically, run passes, and assert on the result
  • Use pytest.mark.fuzzing for slow/fuzz tests (skipped in quick runs)
  • Use pytest.mark.hevm for hevm-specific tests