Skip to content

Commit

Permalink
[TEST] Move tests against api in preparation for mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Aedial committed Nov 28, 2022
1 parent 0caf2c9 commit 19984db
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pylint = "^2.15.5"
# TODO: add flake when supports come

[tool.bandit]
exclude_dirs = ["tests/test_decrypt_encrypt_integrity_check.py"]
exclude_dirs = ["tests/api/test_decrypt_encrypt_integrity_check.py"]
skips = ["B101", "B311"]

[tool.black]
Expand All @@ -50,7 +50,7 @@ ignore-paths = [
"novelai_api/tokenizers",
# Code unused atm
"novelai_api/story.py",
"tests/disabled_test_manipulate_stories"
"tests/api/disabled_test_manipulate_stories"
]
disable = [
# access to private members
Expand All @@ -67,6 +67,14 @@ disable = [
"R0902", "R0903", "R0904", "R0913", "R0914"
]

[tool.pylint.MASTER]
# add novelai_api to the path, as pylint fails to detect the package (waiting for https://github.com/PyCQA/pylint/projects/1)
init-hook="""
from sys import path
from pylint.config import find_default_config_files
path.extend(p.parent for p in find_default_config_files())
"""

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
from os import environ as env
from os.path import abspath, dirname, join
from sys import path

path.insert(0, abspath(join(dirname(__file__), "..")))

import asyncio
from logging import Logger, StreamHandler
from os import environ as env
from random import choice

from aiohttp import ClientSession
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from asyncio import run
from os import environ as env
from os.path import abspath, dirname, join
from pathlib import Path
from subprocess import PIPE, Popen
from sys import path
from typing import Any, List

from aiohttp import ClientSession

# pylint: disable=C0413,C0415
path.insert(0, abspath(join(dirname(__file__), "..")))
from novelai_api import NovelAIAPI, utils
from novelai_api.utils import (
compress_user_data,
Expand All @@ -32,7 +29,7 @@ def compare_in_out(type_name: str, items_in: List[Any], items_out: List[Any]) ->
return True


fflate_path = join(dirname(abspath(__file__)), "fflate_inflate.js")
fflate_path = Path("fflate_inflate.js").absolute()


def inflate_js(data: bytes, _) -> bytes:
Expand Down
4 changes: 0 additions & 4 deletions tests/test_generate.py → tests/api/test_generate.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import asyncio
from logging import Logger, StreamHandler
from os import environ as env
from os.path import abspath, dirname, join
from sys import path
from typing import Tuple

import pytest
from aiohttp import ClientConnectionError, ClientPayloadError, ClientSession

# pylint: disable=C0413,C0415
path.insert(0, abspath(join(dirname(__file__), "..")))
from novelai_api import NovelAIAPI, NovelAIError
from novelai_api.BanList import BanList
from novelai_api.BiasGroup import BiasGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
from asyncio import gather, run
from logging import Logger, StreamHandler
from os import environ as env
from os.path import abspath, dirname, join
from sys import path

import pytest
from aiohttp import ClientSession

# pylint: disable=C0413,C0415
path.insert(0, abspath(join(dirname(__file__), "..")))
from novelai_api import NovelAIAPI
from novelai_api.GlobalSettings import GlobalSettings
from novelai_api.Preset import Model, Preset
Expand Down

0 comments on commit 19984db

Please sign in to comment.