Skip to content

Commit

Permalink
Merge pull request #2 from ancientjpeg/add-pytest
Browse files Browse the repository at this point in the history
Add pytest
  • Loading branch information
ancientjpeg authored Mar 17, 2024
2 parents bc217e2 + b294505 commit 3b17977
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test And Lint Using Conda

on: [push]

jobs:
test-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
conda env update --file environment.yml --name base
- name: Lint with flake8
run: |
conda install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
conda install pytest
pytest
51 changes: 51 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: playlistr
channels:
- defaults
dependencies:
- aiohttp=3.9.3
- aiosignal=1.2.0
- attrs=23.1.0
- black=23.11.0
- brotli-python=1.0.9
- bzip2=1.0.8
- ca-certificates=2023.12.12
- certifi=2024.2.2
- cffi=1.16.0
- charset-normalizer=2.0.4
- click=8.1.7
- cryptography=41.0.7
- debugpy=1.6.7
- expat=2.5.0
- frozenlist=1.4.0
- idna=3.4
- iniconfig=1.1.1
- libcxx=14.0.6
- libffi=3.4.4
- multidict=6.0.4
- mypy_extensions=1.0.0
- ncurses=6.4
- openssl=3.0.13
- packaging=23.1
- pathspec=0.10.3
- pip=23.3.1
- platformdirs=3.10.0
- pluggy=1.0.0
- pycparser=2.21
- pyjwt=2.4.0
- pyopenssl=23.2.0
- pysocks=1.7.1
- pytest=7.4.0
- python=3.12.1
- readline=8.2
- requests=2.31.0
- setuptools=68.2.2
- sqlite=3.41.2
- tk=8.6.12
- tzdata=2023d
- urllib3=1.26.18
- wheel=0.41.2
- xz=5.4.5
- yarl=1.9.3
- zlib=1.2.13
- pip:
- oauthlib==3.2.2
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "playlistr"
description = "A streaming service migration CLI tool."
dynamic = ["version"]

[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
]
pythonpath = [
"src"
]

[tool.hatch]
2 changes: 1 addition & 1 deletion src/playlistr/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Secrets:
secrets: dict = None
secrets_file = "secrets.json"
secrets_file = "../secrets.json"

@classmethod
def get(cls):
Expand Down
8 changes: 8 additions & 0 deletions test/typing/test_typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from playlistr.service import Service
from playlistr.spotify import Spotify
from playlistr.apple_music import AppleMusic


def test_typing():
assert issubclass(Spotify, Service)
assert issubclass(AppleMusic, Service)

0 comments on commit 3b17977

Please sign in to comment.