fix: resolve linting errors (W292, W293) in test files #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Debug - Check environment | |
| run: | | |
| echo "Python version:" | |
| python --version | |
| echo "Python path:" | |
| which python | |
| echo "Site packages:" | |
| python -c "import site; print(site.getsitepackages())" | |
| echo "Current directory:" | |
| pwd | |
| echo "Directory contents:" | |
| ls -la | |
| echo "Installed packages:" | |
| pip list | |
| - name: Debug - Test package import | |
| run: | | |
| echo "Testing direct import:" | |
| python -c "import nutrient_dws; print('Import successful:', nutrient_dws.__version__)" | |
| echo "Testing submodule imports:" | |
| python -c "from nutrient_dws.client import NutrientClient; print('Client import successful')" | |
| python -c "from nutrient_dws.exceptions import NutrientError; print('Exceptions import successful')" | |
| - name: Debug - Check test structure | |
| run: | | |
| echo "Test directory structure:" | |
| find tests -name "*.py" -type f | |
| echo "Test __init__ files:" | |
| find tests -name "__init__.py" -type f | |
| echo "Python path:" | |
| python -c "import sys; print('\n'.join(sys.path))" | |
| - name: Debug - pytest collection dry run | |
| run: | | |
| echo "Running pytest collection only:" | |
| python -m pytest --collect-only -v | |
| continue-on-error: true | |
| - name: Run linting with ruff | |
| run: | | |
| python -m ruff check . | |
| python -m ruff format --check . | |
| - name: Run type checking with mypy | |
| run: python -m mypy src tests | |
| - name: Run basic test without coverage | |
| run: | | |
| echo "Running basic test without any plugins:" | |
| python -m pytest tests/test_basic.py -v -p no:asyncio -p no:cov | |
| continue-on-error: true | |
| - name: Run all tests without coverage | |
| run: | | |
| echo "Running all tests without coverage:" | |
| python -m pytest -v -p no:asyncio | |
| continue-on-error: true | |
| - name: Run tests with pytest (with coverage) | |
| run: python -m pytest -v --cov=nutrient_dws --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package with twine | |
| run: twine check dist/* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ |