Skip to content

Commit 878753a

Browse files
committed
tests: refresh README, docstrings
1 parent 58b0d9c commit 878753a

File tree

3 files changed

+34
-30
lines changed

3 files changed

+34
-30
lines changed

tests/README.md

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
# solc-select Test Suite
22

3-
This directory contains the pytest-based test suite for solc-select, converted from the original bash scripts.
3+
This directory contains the pytest-based test suite for solc-select.
44

55
## Test Structure
66

77
- `conftest.py` - Pytest configuration and fixtures for test isolation
8-
- `test_compiler_versions.py` - Tests for different Solidity compiler versions (from test_solc.sh)
9-
- `test_platform_specific.py` - Platform-specific boundary tests (from test_linux.sh, test_macos.sh, test_windows.sh)
10-
- `test_upgrade.py` - Tests for upgrade functionality (from test_solc_upgrade.sh)
8+
- `test_compiler_versions.py` - Tests for different Solidity compiler versions
9+
- `test_platform_specific.py` - Platform-specific boundary tests
10+
- `test_upgrade.py` - Tests for upgrade functionality
1111

1212
## Running Tests
1313

1414
### Install test dependencies
15+
1516
```bash
1617
# Install with all development dependencies (testing + linting)
1718
pip install -e ".[dev]"
1819
```
1920

2021
### Run all tests
22+
2123
```bash
2224
pytest
2325
```
2426

2527
### Run specific test files
28+
2629
```bash
2730
pytest tests/test_compiler_versions.py
31+
pytest tests/test_platform_specific.py
32+
pytest tests/test_upgrade.py
2833
```
2934

3035
### Run platform-specific tests
36+
3137
```bash
3238
# Only run tests for current platform
3339
pytest -m "not (linux or macos or windows)"
@@ -43,38 +49,37 @@ pytest -m windows
4349
```
4450

4551
### Run tests in parallel (faster)
46-
```bash
47-
pytest -n auto
48-
```
4952

50-
### Skip slow tests (like upgrade test)
5153
```bash
52-
pytest -m "not slow"
54+
pytest -n auto
5355
```
5456

5557
## Test Fixtures
5658

5759
The test suite uses several fixtures to ensure proper isolation:
5860

59-
- `backup_current_version` - Backs up and restores the current solc version
60-
- `clean_artifacts` - Provides complete isolation by backing up all installed versions
61-
- `run_command` - Executes shell commands exactly as the bash tests did
62-
- `test_contracts_dir` - Path to test Solidity contracts
61+
- `isolated_solc_data` - Creates isolated solc-select data environment using VIRTUAL_ENV
62+
- `isolated_python_env` - Creates completely isolated Python environment for install/uninstall tests
63+
- `test_contracts_dir` - Path to test Solidity contracts in `tests/solidity_tests/`
64+
65+
### Helper Functions
66+
67+
- `run_command` - Executes shell commands for tests using `isolated_solc_data`
68+
- `run_in_venv` - Executes commands in isolated virtual environments
69+
70+
## Test Organization
6371

64-
## Comparison with Bash Tests
72+
| Test Module | Test Class | Description |
73+
|------------|-------------|-------------|
74+
| test_compiler_versions.py | TestCompilerVersions | Compiler version tests |
75+
| test_compiler_versions.py | TestVersionSwitching | Version switching functionality tests |
76+
| test_platform_specific.py | TestPlatformSpecific | Platform boundary tests |
77+
| test_upgrade.py | TestUpgrade | Upgrade preservation tests |
6578

66-
The pytest tests are designed to be a conservative 1:1 conversion of the bash tests:
79+
## Test Configuration
6780

68-
| Bash Script | Pytest Module | Description |
69-
|------------|---------------|-------------|
70-
| test_solc.sh | test_compiler_versions.py | Compiler version tests |
71-
| test_linux.sh | test_platform_specific.py::TestLinuxSpecific | Linux boundary tests |
72-
| test_macos.sh | test_platform_specific.py::TestMacOSSpecific | macOS boundary tests |
73-
| test_windows.sh | test_platform_specific.py::TestWindowsSpecific | Windows boundary tests |
74-
| test_solc_upgrade.sh | test_upgrade.py | Upgrade preservation tests |
81+
Test configuration is defined in `pyproject.toml` under `[tool.pytest.ini_options]`, including:
7582

76-
The tests maintain the exact same:
77-
- Command execution patterns
78-
- Error message checking
79-
- Version installation behavior
80-
- Platform-specific constraints
83+
- Custom markers for platform-specific tests (linux, macos, windows)
84+
- Test discovery patterns
85+
- Default options for verbose output and strict marker checking

tests/test_compiler_versions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Test Solidity compiler version-specific functionality.
33
4-
This module tests compilation with different Solidity versions,
5-
exactly mirroring the behavior of the original test_solc.sh script.
4+
This module tests compilation with different Solidity versions.
65
"""
76

87
from .conftest import run_command

tests/test_upgrade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Test solc-select upgrade functionality.
33
44
This module tests that upgrading solc-select preserves installed
5-
compiler versions, exactly mirroring test_solc_upgrade.sh.
5+
compiler versions.
66
"""
77

88
from pathlib import Path

0 commit comments

Comments
 (0)