Skip to content

Commit 945d146

Browse files
Create conftest.py
1 parent e70f57c commit 945d146

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

tests/conftest.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
"""Pytest configuration and fixtures."""
2+
3+
import os
4+
import pytest
5+
from pathlib import Path
6+
7+
8+
@pytest.fixture
9+
def sample_contract():
10+
"""Sample Vyper contract content."""
11+
return '''"""
12+
ERC20 Token Implementation
13+
This is a sample ERC20 token contract.
14+
"""
15+
16+
@external
17+
def transfer(to: address, amount: uint256) -> bool:
18+
"""
19+
Transfer tokens to a specified address.
20+
21+
Args:
22+
to: The recipient address
23+
amount: The amount to transfer
24+
25+
Returns:
26+
bool: Success status
27+
"""
28+
return True
29+
30+
@external
31+
def balance_of(account: address) -> uint256:
32+
"""
33+
Get the token balance of an account.
34+
35+
Args:
36+
account: The address to query
37+
38+
Returns:
39+
uint256: Token balance
40+
"""
41+
return 0
42+
'''
43+
44+
45+
@pytest.fixture
46+
def contracts_dir(tmp_path, sample_contract):
47+
"""Create a temporary directory with sample contracts."""
48+
contracts = tmp_path / "contracts"
49+
contracts.mkdir()
50+
51+
# Create main contract
52+
contract_file = contracts / "token.vy"
53+
contract_file.write_text(sample_contract)
54+
55+
# Create nested contract
56+
nested_dir = contracts / "nested"
57+
nested_dir.mkdir()
58+
nested_contract = nested_dir / "nested_token.vy"
59+
nested_contract.write_text(sample_contract)
60+
61+
return contracts
62+
63+
64+
@pytest.fixture
65+
def output_dir(tmp_path):
66+
"""Create a temporary output directory."""
67+
output = tmp_path / "output"
68+
output.mkdir()
69+
return output

0 commit comments

Comments
 (0)