Skip to content

Commit 772a902

Browse files
committed
Fix all Vader tests and simplify test runner infrastructure
- Fix autopep8.vader tests (8/8 passing) * Initialize Python paths before loading autoload files in setup.vim * Make code_check import lazy in autoload/pymode/lint.vim * Ensures Python modules are available when autoload functions execute - Fix commands.vader PymodeLintAuto test (7/7 passing) * Same root cause as autopep8 - Python path initialization * All command tests now passing - Simplify test runner infrastructure * Rename dual_test_runner.py -> run_tests.py (no longer dual) * Rename run-vader-tests.sh -> run_tests.sh * Remove legacy test support (all migrated to Vader) * Update all references and documentation - Update TEST_FAILURES.md * Document all fixes applied * Mark all test suites as passing (8/8) All 8 Vader test suites now passing: ✅ autopep8.vader - 8/8 tests ✅ commands.vader - 7/7 tests ✅ folding.vader - All tests ✅ lint.vader - All tests ✅ motion.vader - All tests ✅ rope.vader - All tests ✅ simple.vader - All tests ✅ textobjects.vader - All tests
1 parent 6fe299e commit 772a902

11 files changed

Lines changed: 280 additions & 265 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ jobs:
5858
export TEST_SUITE="${{ matrix.test-suite }}"
5959
export GITHUB_ACTIONS=true
6060
61-
# Run dual test suite (both legacy and Vader tests)
62-
python scripts/cicd/dual_test_runner.py
61+
# Run Vader test suite
62+
python scripts/cicd/run_tests.py
6363
6464
- name: Upload test results
6565
uses: actions/upload-artifact@v4

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ htmlcov/
2525
*.cover
2626
.hypothesis/
2727
.pytest_cache/
28+
# Temporary test runner scripts
29+
.tmp_run_test_*.sh

‎TEST_FAILURES.md‎

Lines changed: 23 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,48 @@
11
# Known Test Failures - Investigation Required
22

3-
## Status: Partially Fixed
3+
## Status: ✅ All Tests Passing
44

5-
The Vader test infrastructure has been improved with Vader.vim installation in Dockerfile and enhanced test runner script. However, some tests are still failing due to python-mode functionality issues.
5+
All Vader test suites are now passing! The issues have been resolved by fixing Python path initialization and making imports lazy.
66

77
## Test Results Summary
88

9-
### ✅ Passing Test Suites (6/8)
9+
### ✅ Passing Test Suites (8/8)
10+
- `autopep8.vader` - All 8 tests passing ✅
11+
- `commands.vader` - All 7 tests passing ✅
1012
- `folding.vader` - All tests passing
1113
- `lint.vader` - All tests passing
1214
- `motion.vader` - All tests passing
1315
- `rope.vader` - All tests passing
1416
- `simple.vader` - All tests passing
1517
- `textobjects.vader` - All tests passing
1618

17-
### ⚠️ Failing Test Suites (2/8)
18-
19-
#### 1. autopep8.vader - 1/8 tests passing
20-
21-
**Error:**
22-
```
23-
E117: Unknown function: pymode#lint#auto
24-
```
25-
26-
**Root Cause:**
27-
The `pymode#lint#auto` function is defined in `autoload/pymode/lint.vim` but is not being loaded/available in the Vader test environment.
28-
29-
**Affected Tests:**
30-
- Test multiple formatting issues
31-
- Test autopep8 with class formatting
32-
- Test autopep8 with long lines
33-
- Test autopep8 with imports
34-
- Test autopep8 preserves functionality
35-
- Test autopep8 with well-formatted code
36-
37-
**Investigation Needed:**
38-
1. Verify autoload function loading mechanism in Vader test setup
39-
2. Check if `autoload/pymode/lint.vim` is being sourced properly
40-
3. Verify python-mode plugin initialization sequence in test containers
41-
4. Check if runtimepath includes autoload directories correctly
19+
## Fixes Applied
4220

43-
#### 2. commands.vader - 6/7 tests passing
21+
### Track 3: Test Fixes (Completed)
4422

45-
**Error:**
46-
```
47-
PymodeLintAuto produced no changes
48-
```
23+
**Issue:** Python module imports were failing because:
24+
1. Python paths were not initialized before autoload files imported Python modules
25+
2. Top-level imports in `autoload/pymode/lint.vim` executed before `patch_paths()` added submodules to sys.path
4926

50-
**Root Cause:**
51-
One test expects `PymodeLintAuto` to format code, but it's not producing changes. This is likely related to the same autoload function loading issue affecting autopep8.vader.
27+
**Solution:**
28+
1. **Fixed `tests/vader/setup.vim`:**
29+
- Added Python path initialization (`pymode#init()`) before loading autoload files that import Python modules
30+
- Ensured `patch_paths()` is called to add submodules to sys.path
31+
- Used robust plugin root detection
5232

53-
**Affected Test:**
54-
- Test PymodeLintAuto command
33+
2. **Fixed `autoload/pymode/lint.vim`:**
34+
- Made `code_check` import lazy (moved from top-level to inside `pymode#lint#check()` function)
35+
- This ensures Python paths are initialized before the import happens
5536

56-
**Investigation Needed:**
57-
1. Same as autopep8.vader - autoload function loading
58-
2. Verify PymodeLintAuto command is properly registered
59-
3. Check if autopep8 functionality is working in test environment
37+
**Files Modified:**
38+
- `tests/vader/setup.vim` - Added Python path initialization
39+
- `autoload/pymode/lint.vim` - Made imports lazy
6040

61-
## Fixes Applied
41+
### Previous Fixes
6242

63-
### Commit: 48c868a
43+
#### Commit: 48c868a
6444
- ✅ Added Vader.vim installation to Dockerfile
6545
- ✅ Improved test runner script error handling
6646
- ✅ Enhanced success detection for Vader output
6747
- ✅ Changed to use Vim's -es mode for better output handling
6848

69-
## Next Steps
70-
71-
1. **Investigate autoload function loading**
72-
- Check `tests/utils/vimrc` runtimepath configuration
73-
- Verify autoload directory is in runtimepath
74-
- Test manual loading of `autoload/pymode/lint.vim`
75-
76-
2. **Debug test environment**
77-
- Run tests with verbose Vim output
78-
- Check if python-mode plugin is fully initialized
79-
- Verify all autoload functions are available
80-
81-
3. **Fix autoload loading**
82-
- Ensure autoload functions are loaded before tests run
83-
- May need to explicitly source autoload files in test setup
84-
- Or ensure runtimepath is correctly configured
85-
86-
## Related Files
87-
88-
- `autoload/pymode/lint.vim` - Contains `pymode#lint#auto` function
89-
- `ftplugin/python/pymode.vim` - Defines `PymodeLintAuto` command
90-
- `tests/utils/vimrc` - Test configuration file
91-
- `tests/vader/setup.vim` - Vader test setup
92-
- `tests/vader/autopep8.vader` - Failing test suite
93-
- `tests/vader/commands.vader` - Partially failing test suite
94-

‎autoload/pymode/lint.vim‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
PymodePython from pymode.lint import code_check
1+
" Note: code_check is imported lazily in pymode#lint#check() to avoid
2+
" importing Python modules before paths are initialized
23

34
call pymode#tools#signs#init()
45
call pymode#tools#loclist#init()
@@ -57,6 +58,8 @@ fun! pymode#lint#check() "{{{
5758

5859
call pymode#wide_message('Code checking is running ...')
5960

61+
" Import code_check lazily here to ensure Python paths are initialized
62+
PymodePython from pymode.lint import code_check
6063
PymodePython code_check()
6164

6265
if loclist.is_empty()

‎scripts/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ This directory contains scripts for testing and CI/CD automation, organized into
77
Scripts used by the GitHub Actions CI/CD pipeline:
88

99
- **check_python_docker_image.sh** - Handles Python version resolution (especially for Python 3.13)
10-
- **dual_test_runner.py** - Orchestrates running both legacy bash tests and Vader tests
10+
- **run_tests.py** - Runs the Vader test suite (legacy bash tests have been migrated to Vader)
1111
- **generate_test_report.py** - Generates HTML/Markdown test reports for CI/CD
1212

1313
## 📁 user/ - User Scripts
1414

1515
Scripts for local development and testing:
1616

1717
- **run-tests-docker.sh** - Run tests with a specific Python version locally
18-
- **run-vader-tests.sh** - Run Vader test suite (also used by dual_test_runner.py)
18+
- **run_tests.sh** - Run Vader test suite (also used by run_tests.py)
1919
- **test-all-python-versions.sh** - Test against all supported Python versions
2020

2121
## Usage Examples
@@ -33,7 +33,7 @@ Scripts for local development and testing:
3333
./scripts/user/test-all-python-versions.sh
3434

3535
# Run only Vader tests
36-
./scripts/user/run-vader-tests.sh
36+
./scripts/user/run_tests.sh
3737
```
3838

3939
### CI/CD (automated)

‎scripts/cicd/dual_test_runner.py‎

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)