Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for python scripts #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on: [push, pull_request]
name: Pytest
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
python-version: ['3.7', '3.8' ,'3.9', '3.10', '3.11']
fail-fast: false
name: Python ${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.frontend }} build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements
run: |
pip install pytest
- name: Run pytest
run: python -m pytest

1 change: 1 addition & 0 deletions tests/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is just an empty file
4 changes: 4 additions & 0 deletions tests/simple_salesforce.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is just a file to mock the import
from unittest.mock import Mock

Salesforce = Mock()
15 changes: 15 additions & 0 deletions tests/test_transcodeEngine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pathlib
import pytest


@pytest.mark.parametrize(
'file_path,expected_barcode',
[
(pathlib.Path('12345677890.mp4'), '5677890'),
(pathlib.Path('12346677890.mov'), '6677890'),
]
)
def test_getBarcode(file_path, expected_barcode):
import transcodeEngine
assert transcodeEngine.getBarcode(str(file_path)) == expected_barcode