Files
local-api-docs-search/tests/conftest.py
7000pctAUTO f2e4c149ef
Some checks failed
CI / test (3.10) (push) Failing after 5m55s
CI / test (3.11) (push) Failing after 5m54s
CI / test (3.12) (push) Failing after 6m5s
CI / build (push) Has been skipped
fix: resolve CI/CD issues with proper package structure and imports
2026-02-03 03:54:50 +00:00

138 lines
2.4 KiB
Python

"""Pytest configuration and fixtures."""
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
@pytest.fixture(scope="session")
def project_root():
"""Get the project root directory."""
return Path(__file__).parent.parent
@pytest.fixture
def temp_dir(tmp_path):
"""Create a temporary directory for tests."""
return tmp_path
@pytest.fixture
def sample_openapi_content():
"""Sample OpenAPI specification content."""
return """
openapi: "3.0.0"
info:
title: Sample API
version: "1.0.0"
description: A sample API for testing
paths:
/users:
get:
summary: List users
description: Get a list of all users
operationId: listUsers
responses:
'200':
description: Successful response
/users/{id}:
get:
summary: Get user by ID
operationId: getUser
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: User found
'404':
description: User not found
"""
@pytest.fixture
def sample_readme_content():
"""Sample README content."""
return """# Project Title
This is a sample project.
## Installation
Run `pip install` to install dependencies.
## Usage
```python
from project import main
main()
```
## API
### `main()`
The main entry point of the application.
### `process_data(data)`
Process the given data.
**Parameters:**
- `data` (dict): The data to process
**Returns:**
- dict: Processed data
"""
@pytest.fixture
def sample_python_content():
"""Sample Python code with docstrings."""
return '''"""Sample module for testing."""
def example_function(param1, param2):
"""Example function with parameters.
Args:
param1: First parameter
param2: Second parameter
Returns:
Combined result
"""
return param1 + param2
class ExampleClass:
"""Example class for testing.
Attributes:
value: The stored value
"""
def __init__(self, initial_value=0):
"""Initialize with a value.
Args:
initial_value: Starting value
"""
self.value = initial_value
def get_value(self):
"""Get the current value.
Returns:
The current value
"""
return self.value
'''