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

test: add tests to codebase #116

Merged
merged 53 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
b2025a5
test: added first tests
marksie1988 Jun 28, 2022
f96b51c
fix: added more tests and resolved assertion issues
marksie1988 Jun 29, 2022
18531f4
feat: added tests and sort to get_queue
marksie1988 Jun 29, 2022
dfbf8a4
test: added tests for parse endpoint
marksie1988 Jun 29, 2022
494fd0d
fix: added tests for release and resolved type hint issues
marksie1988 Jun 29, 2022
187cb3f
tests: added download_release
marksie1988 Jun 29, 2022
d154a81
fix: resolved assertion error with get_command and added more tests
marksie1988 Jun 30, 2022
afdf17d
fix(sonarr): resolved issues with post_command, updated docs & added …
marksie1988 Jun 30, 2022
932ef07
test: Added final tests for Sonarr
marksie1988 Jul 2, 2022
bda4e51
test: Adding base tests for Sonarr
marksie1988 Jul 3, 2022
af1fed2
tests: updated tests for Sonarr & resolved issues with get_log
marksie1988 Jul 5, 2022
43bf351
tests: Added more tests and fixed type hint issues
marksie1988 Jul 7, 2022
ced316a
fix: blocklist using incorrect params and added tests
marksie1988 Jul 8, 2022
b005d13
fix: get_task missing arguments and incorrect type, added more tests
marksie1988 Jul 13, 2022
925f7f0
test: added more tests, refactored some functions
marksie1988 Jul 14, 2022
427ebdd
fix: added error when no implementation is found
marksie1988 Jul 14, 2022
44e5afc
tests: added for get_download_client and tags
marksie1988 Jul 14, 2022
545a8c5
test: added more tests & implemented new methods
marksie1988 Jul 15, 2022
9167dd8
refactor: more tests added, fixed get_movie_file
marksie1988 Jul 26, 2022
b4851b7
test: added more tests, updated queue methods
marksie1988 Jul 26, 2022
b6ed956
test: Added more tests
marksie1988 Jul 26, 2022
d24861a
feat: added method add_root_folder
marksie1988 Jul 28, 2022
010982a
tests: added more tests for radarr
marksie1988 Jul 28, 2022
25f12f9
tests: added del_movies test, fixed put assertion errors
marksie1988 Aug 2, 2022
86c9b5d
test: added more tests, fixed post assertion errors
marksie1988 Aug 3, 2022
ac2e908
tests: Added more tests
marksie1988 Aug 3, 2022
cdacb4d
fix: changed all blacklist to blocklist
marksie1988 Aug 4, 2022
b9ced6d
test: added more tests
marksie1988 Aug 17, 2022
d75eacb
test: adding lidarr tests
marksie1988 Aug 19, 2022
23bacf2
refactor: change add_album to use musicbrainz id, added more tests
marksie1988 Aug 22, 2022
d2b23f2
refactor(lidarr): updated get_wanted to match ordering of options wit…
marksie1988 Aug 30, 2022
bc48d4f
feat(request_handler): strip trailing slashes from URL
marksie1988 Aug 30, 2022
60c0eac
tests: Added all lidarr tests
marksie1988 Aug 31, 2022
f913151
tests: added all lidarr tests
marksie1988 Sep 20, 2022
2cd3306
tests: added more tests
marksie1988 Sep 21, 2022
0d913e5
feat: added nox & updated workflows
marksie1988 Oct 3, 2022
b982d27
feat: added JSON type
marksie1988 Nov 8, 2022
8509e59
refactor: improve typing and assertions
marksie1988 Nov 9, 2022
37d6658
refactor: change models to dataclasses from enum
marksie1988 Nov 10, 2022
36adf30
refactor: add type for JsonArray, JsonObject & change enums
marksie1988 Nov 11, 2022
53efc1d
test: Adding initial test with docker
marksie1988 Nov 11, 2022
f60b196
test: Adding initial test with docker
marksie1988 Nov 11, 2022
c319a02
feat: Added arr config files for testing against live DBs
marksie1988 Nov 12, 2022
0f9b539
fix: incorrect workflow config
marksie1988 Nov 12, 2022
ec4f81f
test: revised all tests to use live API, still WIP
marksie1988 Mar 19, 2023
65cf4c8
test: Added more tests for lidarr and fixed sonarr tests
marksie1988 Mar 27, 2023
61861c6
ci: testing github actions
marksie1988 Mar 27, 2023
096623f
ci: testing github actions
marksie1988 Mar 27, 2023
0f7b50b
test: Added more tests
marksie1988 Mar 28, 2023
7a06a70
fix: resolved issues wwith add_movie and add_artist
marksie1988 Mar 29, 2023
30ad67a
ci: add code coverage
marksie1988 Mar 29, 2023
0e641a2
refactor: change the enums to literals
marksie1988 Mar 30, 2023
eaed5f3
ci: update to check python 3.9, 3.10 & 3.11
marksie1988 Mar 30, 2023
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
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[run]
source = pyarr

omit =
# omit tests
tests/*

[report]
exclude_lines =
if TYPE_CHECKING:
2 changes: 1 addition & 1 deletion .devcontainer/recommended-Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt upgrade -y

RUN apt install zsh python3-sphinx -y

RUN pip install --user poetry
RUN pip install --user poetry nox
ENV PATH="${PATH}:/root/.local/bin"

RUN wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O - | zsh || true
Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[flake8]
max-line-length = 88
max-complexity = 18
exclude = build/*
exclude = build/*, tests/*, .nox/*
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
Expand Down
26 changes: 1 addition & 25 deletions .github/workflows/pr.yml → .github/workflows/check-version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pr
name: Check Version has been updated

on:
pull_request:
Expand Down Expand Up @@ -30,27 +30,3 @@ jobs:
uses: dudo/[email protected]
with:
git_tag_prefix: v
code-quality:
name: 📊 Check code quality
runs-on: ubuntu-latest
steps:
- name: Getting your configuration from GitHub
uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Run image
uses: abatilo/[email protected]
- name: Install dependencies with Poetry
run: poetry install
- name: 📦 Check imports
run: poetry run isort --diff pyarr
- name: 🏴 Check Black formatting
run: poetry run black --check pyarr
- name: ❄️ Check flake8 formatting
run: poetry run flake8 pyarr
- name: Check static type
run: poetry run mypy pyarr
- name: Check docstrings
run: poetry run interrogate pyarr
16 changes: 0 additions & 16 deletions .github/workflows/greetings.yml

This file was deleted.

File renamed without changes.
30 changes: 11 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,19 @@ jobs:
code-quality:
name: 📊 Check code quality
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Getting your configuration from GitHub
uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v1
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Run image
uses: abatilo/[email protected]
- name: Install dependencies with Poetry
run: poetry install
- name: 📦 Check imports
run: poetry run isort --diff pyarr
- name: 🏴 Check Black formatting
run: poetry run black --check pyarr
- name: ❄️ Check flake8 formatting
run: poetry run flake8 pyarr
- name: Check static type
run: poetry run mypy pyarr
- name: Check docstrings
run: poetry run interrogate pyarr
python-version: ${{ matrix.python-version }}
- name: 🧪 Check tests are passing
run: |
pip install poetry nox
nox -s test

build-n-publish:
name: Create release and publish 🐍 distribution 📦 to PyPI
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"

jobs:
source:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 🧪 Check tests are passing
run: |
pip install poetry nox
nox -s test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ build
*.egg-info
.mypy_cache
.pytest_cache
.coverage
coverage.xml
_build

.devcontainer/*
!.devcontainer/recommended-devcontainer.json
Expand Down
65 changes: 65 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from __future__ import annotations

import nox
from nox.sessions import Session


@nox.session(reuse_venv=True)
def format(session: Session) -> None:
"""Run automatic code formatters"""
session.run("poetry", "install", external=True)
session.run("black", ".")
session.run("isort", ".")
session.run("autoflake", "--in-place", ".")


@nox.session(reuse_venv=True)
def coverage(session: Session) -> None:
"""Check tests cover all code"""
session.run("poetry", "install", external=True)
session.run("pytest", "tests", "--cov=pyarr", "--cov-report", "term-missing", "-vv")


@nox.session(reuse_venv=True)
def test(session: Session) -> None:
"""Run the complete test suite"""
session.run("poetry", "install", external=True)
session.notify("test_types")
session.notify("test_style")
session.notify("test_suite")


@nox.session(reuse_venv=True)
def test_suite(session: Session) -> None:
"""Run the Python-based test suite"""
session.run("poetry", "install", external=True)
session.run("pytest", "tests")


@nox.session(reuse_venv=True)
def test_types(session: Session) -> None:
"""Check that typing is working as expected"""
session.run("poetry", "install", external=True)
session.run("mypy", "--show-error-codes", "pyarr")


@nox.session(reuse_venv=True)
def test_style(session: Session) -> None:
"""Check that style guidelines are being followed"""
session.run("poetry", "install", external=True)
session.run("flake8", "pyarr", "tests")
session.run(
"black",
".",
"--check",
)
session.run("isort", ".", "--check-only")
session.run("autoflake", ".")
session.run("interrogate", "pyarr")


@nox.session(reuse_venv=True)
def docs(session: Session) -> None:
"""Create local copy of docs for testing"""
session.run("poetry", "install", external=True)
session.run("sphinx-build", "sphinx-docs", "build")
Loading