Skip to content

Commit

Permalink
Update tests and CI workflow configurations
Browse files Browse the repository at this point in the history
Added `# noqa: E402` to `pyasstosrt` import in `conftest.py` to suppress import error warning. Revised GitHub Actions workflow for better readability and updated actions versions; streamlined Poetry setup, test execution, and coverage reporting.
  • Loading branch information
GitBib committed Sep 1, 2024
1 parent 4ba0e30 commit e450637
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
52 changes: 29 additions & 23 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,36 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install App Dependencies
run: poetry install --no-interaction --no-root
- name: Run tests
run: |
poetry run coverage run -m pytest
poetry run coverage report
- name: Upload coverage reports to Codecov
run: poetry run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Run tests and collect coverage
run: |
source .venv/bin/activate
pytest --cov=pyasstosrt tests/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

deploy:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, f'{myPath}/../')

from pyasstosrt import Subtitle
from pyasstosrt import Subtitle # noqa: E402


@pytest.fixture
Expand Down

0 comments on commit e450637

Please sign in to comment.