fix: resolve CI test failures in conftest.py
- Fix deprecated typing import (typing.Generator -> collections.abc.Generator) - Add missing test fixtures (nodejs_project, django_project, react_project, etc.) - Add requirements.txt and setup.py to python_project fixture - Add mkdir() calls for missing parent directories in fixtures
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
"""Pytest configuration and fixtures for codechunk tests."""
|
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -458,6 +456,63 @@ export default App;
|
|||||||
return temp_project_dir
|
return temp_project_dir
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def vscode_project(temp_project_dir: Path) -> Path:
|
||||||
|
"""Create a mock VSCode project structure."""
|
||||||
|
vscode_dir = temp_project_dir / ".vscode"
|
||||||
|
vscode_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
(vscode_dir / "extensions.json").write_text('''
|
||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"ms-python.python",
|
||||||
|
"ms-vscode.vscode-typescript-next"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
''')
|
||||||
|
|
||||||
|
(vscode_dir / "settings.json").write_text('''
|
||||||
|
{
|
||||||
|
"python.defaultInterpreterPath": "/usr/bin/python3",
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"files.exclude": {
|
||||||
|
"**/__pycache__": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''')
|
||||||
|
|
||||||
|
return temp_project_dir
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def jetbrains_project(temp_project_dir: Path) -> Path:
|
||||||
|
"""Create a mock JetBrains project structure."""
|
||||||
|
idea_dir = temp_project_dir / ".idea"
|
||||||
|
idea_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
(idea_dir / "misc.xml").write_text('''
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
''')
|
||||||
|
|
||||||
|
(idea_dir / "modules.xml").write_text('''
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/test_project.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
''')
|
||||||
|
|
||||||
|
return temp_project_dir
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mixed_project(temp_project_dir: Path) -> Path:
|
def mixed_project(temp_project_dir: Path) -> Path:
|
||||||
"""Create a mixed project with Python and Node.js."""
|
"""Create a mixed project with Python and Node.js."""
|
||||||
|
|||||||
Reference in New Issue
Block a user